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
how will you locate the sas platform applications? : Sas-bi
Mention what is SAS data set?
explain the difference between proc means and proc summary?
Mention what is the difference between nodupkey and nodup options?
How do you add a number to a macro variable? : sas-macro
how to remove duplicates using proc sql?
how do the in= variables improve the capability of a merge? : Sas programming
how do you want missing values handled? : Sas programming
How do dates work in SAS data?
What is the maximum and minimum length of macro variable
What are the difference between the sas data step and sas procs?
What are SAS/ACCESS and SAS/CONNECT?
What does proc print, and proc contents are used for?
What is the difference between %put and symbolgen? : sas-macro
How to sort in descending order?