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..

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how merging helps to combine data sets.

618


What are the different types of sas functions?

614


How can sas program be validated?

581


How can you limit the variables written to output dataset in data step?

757


What is the role of unrestrictive users? : sas-grid-administration

575






Explain the difference between nodup and nodupkey options?

613


What is the use of function Proc summary?

657


How sas treats the dsd delimiters?

726


Do you know the features of sas?

598


What are the differences between sum function and using “+” operator?

581


What is the different between functions and PROCs that calculate the same simple descriptive statistics?

1234


What is the difference between one to one merge and match merge? Give an example.

578


for what purpose would you use the retain statement? : Sas programming

589


what is business intelligence? : Sas-bi

585


Do we follow ADAM in analysis dataset development?How? Usually which version? Why is it necessary?

1918