Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


hi guys ...i have one query...
data abc;
input s w k g o t a m;
cards;
1 2 3 4 5 6 7 8
2 3 4 5 6 7 8 9
;
run;

i want the output to be the sorted order(only
variables).observations should not be changed..

Answers were Sorted based on User's Feedback



hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / natraj boga

here is solution to ur problem
options formdlim='.';

data abc;
input s w k g o t a m;
cards;
1 2 3 4 5 6 7 8
2 3 4 5 6 7 8 9
;
run;
**** create a dummy variable by assigning the values of any
one of ur variable;
**** here I have taken the values of S variable of your ABC
data set;
data setabc;
set abc;
l=s;
run;
proc print;run;
* transpose the variables into observations of a transposed
data set by using the ID statement;
proc transpose data=setabc out=T1_abc let;
id l;
run;
proc print;run;
**sort the transposed data set by using _name_ variable
inorder to get varibales in a ascending order;
proc sort data=T1_abc;
by _name_;
run;
proc print;run;
** once again transpose the sorted data set with the _name_
variable in ID statement;
proc transpose data=t1_abc out=t2_abc(drop=_name_) let;
id _name_;
run;
proc print noobs;
title 'sorting the variables in Ascending order';
run;

Is This Answer Correct ?    23 Yes 0 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / m.sivakumar

ata abc;
input s w k g o t a m;
cards;
1 2 3 4 5 6 7 8
2 3 4 5 6 7 8 9
;
run;
proc transpose data=abc out=atranabc;
run;
proc print;
title 'Simple Example of PROC TRANSPOSE';
run;
proc sort data=atranabc;
by _name_;
run;
proc print;
run;
proc transpose data=atranabc out=sortabc(drop=_name_);
run;
proc print data=sortabc;
run;

Is This Answer Correct ?    16 Yes 1 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / neelima

simple..in the proc print statement use VAR statement and
give the variables in ur order...u'll get the ouput with
variables ordered in ur VAR statement..

Is This Answer Correct ?    12 Yes 7 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / aravind9882

yeh neelima is rt...
u will get the variables in the order u mention in the var
statement in proc print.

proc print data =abc;
var a g k m o s t w;
run;

Is This Answer Correct ?    6 Yes 3 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / jose av

No need of doing Tedious codes, just use those variables in
the alphabetical order in a LENGTH statement before setting
(before set statement) .Try this..

data abc_01;
length a g k m o s t 3.;
set abc;
run;

Is This Answer Correct ?    4 Yes 2 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / hetal bhalani

data abc;
input s w k g o t a m;
cards;
1 2 3 4 5 6 7 8
2 3 4 5 6 7 8 9
;
run;

**Transpose your data by listing all the variables you want
to transpose in the VAR statement**

proc transpose data =abc ;
var s w k g o t a m;
run;

**Now you have to sort the values in _name_ variable in asc
**
proc sort data=data1;
by _name_ ;
run;

**now transpose again using _name_ in the ID statement**

proc transpose data=data1 out=data2(drop=_name_);
id _name_;
run;

Is This Answer Correct ?    2 Yes 0 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / surendra

data abc;
input s w k g o t a m;
cards;
1 2 3 4 5 6 7 8
2 3 4 5 6 7 8 9
;
run;


proc transpose data=abc out=bca;
var s w k g o t a m;
run;

proc sort data=bca;
by _name_;
run;

proc transpose data=bca out=mca(drop=_name_);
id _name_;
var col1 col2;
run;

Is This Answer Correct ?    0 Yes 0 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / venu

/*Sorting order by variable*/

data abc;
input s w k g o t a m;
cards;
1 2 3 4 5 6 7 8
2 3 4 5 6 7 8 9
;
run;
proc print data=abc;
run;


proc contents data=abc out=xyz;
run;


proc sql;
select name into :mac separated by " " from xyz;
quit;


proc print data=abc;
var &mac;
run;

Is This Answer Correct ?    0 Yes 0 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / anuj verma

data abc;
infile cards flowover;
input s w k g o t a m;
cards;
1 2 3 4 5 6 7 8
2 3 4 5 6 7 8 9
;
run;

proc transpose data =abc out= abcd;
run;
proc sort data=abcd; by _name_; run;
proc transpose data =abcd out= abcde;
run;


proc print; run;

Is This Answer Correct ?    0 Yes 0 No

hi guys ...i have one query... data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5..

Answer / ashish

proc contents data=abc out=test;
quit;


proc sort data=test;
by name;
quit;

proc sql;

select name into: v_name separated by " " from test;
%put &v_name;


quit;


data abc2;
retain &v_name;
/*retain a g k m o s t w ;*/
set abc ;

run;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SAS Interview Questions

Does SAS ?Translate? (compile) or does it ?Interpret?? Explain.

10 Answers  


What are the features of base sas system?

0 Answers  


If you were told to create many records from one record show how you would do this using arrays and with PROC TRANSPOSE?

1 Answers   HCL, Quintiles,


What are the Aggregate functions in SQL ?

2 Answers   AON,


what is the difference between the SAS v8 and SAS v9?

7 Answers   TCS,


what is the difference between floor and ceil functions in sas? : Sas-administrator

0 Answers  


what is study design in while working with SAS? what are screening variables in SAS?

0 Answers   MSCR,


how are numeric and character missing values represented internally? : Sas programming

0 Answers  


You have a data set of 100 observations,how can you restrict the output so that the output has only data from row no. 10 to row no. 20

9 Answers  


How to convert a given date value into SAS date

9 Answers   CitiGroup, Quintiles,


Briefly explain input and put function?

0 Answers  


Are you familiar with special input delimiters? How are they used?

4 Answers   Accenture,


Categories