Hi All,
I have a large dataset out of which i need to summarize and present a few numbers from it.
My current dataset looks something like below :
Var1 Var2 Var3 Var4 Var5 Var6 Var7
num1 num2 num3 num4 num5 num6 num7
there is nothing i could think of which would make the above dataset look like :
heading heading
Var1 num1
var2 num2
Var3 num3
........... and so on.
Any help would be appreciated.
If you post test data in the form of a datastep you are more likely to get working code. Something like:
data have; set have; id=_n_; run; proc transpose data=have out=want; by id; var var:; run;
If you post test data in the form of a datastep you are more likely to get working code. Something like:
data have; set have; id=_n_; run; proc transpose data=have out=want; by id; var var:; run;
What does Var: means ?
sorry, been programming after ages that i have forgotten even basic things.
Its a shorthand method of stating any variable with teh prefix given, so if I said:
abcd:
This would include any variable name with abcd as first four characters e.g. abcd1234, abcde, but not efg_abcd.
You could also use -- to specify a range (per sort order) of variable names and such like.
Thanks a ton, Your solution worked perfectly but i tweaked a bit.
I had mixed variable names and var: only targeted the specific ones.. i removed this line and dropped the id from the dataset to give out the desired results..
🙂 🙂
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.