proc transpose gives me a table like in document...
I am trying to write a code so that i can have format like 341/367(93%)--- where 93% is % of row total &
367 is row total so i need: 341/367(93%) 26/367(7%) similar format for rest of table. i am able to do it as
a separate variable in table. but i want to replace value of cutoof60 & 61 in new dataset with new values.
i am making a mistake please help me to rectify the code...
PS example data should NEVER be posted in pictures, as that forces everyone else to type data manually off the screen, which means unnecessary work and introduces opportunities for mistakes.
Use data steps with datalines instead:
data tot_trsps;
input trgp_trt cutoff60 cutoff61;
datalines;
1 341 26
2 367 22
;
run;
Please DO NOT use Office documents for posting such simple things as code, logs or textual data.
Use the "little running man" for code like this:
data tot1;
set tot_trsps;
if trgp_trt=1 then
cutoff60= put(cutoff60,3.0)||'/'|| put((cutoff60+cutoff61),3.0)||'('||put((cutoff60/(cutoff60+cutoff61))*100,3.1)||'%)';
run;
It is obvious that you try to convert a variable "in place", which is not possible. SAS variables cannot be of type numeric and character within the same step or dataset.
Create a new variable:
cutoff60_char = put(cutoff60,3.0)||'/'|| put((cutoff60+cutoff61),3.0)||'('||put((cutoff60/(cutoff60+cutoff61))*100,3.1)||'%)';
Thanks a lot for solution and suggestion
i will keep in mind in next post...
PS example data should NEVER be posted in pictures, as that forces everyone else to type data manually off the screen, which means unnecessary work and introduces opportunities for mistakes.
Use data steps with datalines instead:
data tot_trsps;
input trgp_trt cutoff60 cutoff61;
datalines;
1 341 26
2 367 22
;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.