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..
🙂 🙂
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.