BookmarkSubscribeRSS Feed
Ayooo1
Obsidian | Level 7

This might be a simple question but I would to replace the blank with a zero, how can I do that? The picture is the data after transposed.

data Merged_CP (keep= DoseC_P EXDSTXT SEX);
set listing2_1;
by EXDSTXT;
retain COUNT PERCENT EXDSTXT SEX;
length DoseC_P $20;
DoseC_P= strip(put(COUNT,comma12.)||''|| put(-PERCENT/100,percent7.1));
run;
proc sort data=Merged_CP;
by SEX;
run;
proc transpose data=Merged_CP out=EXDM (drop=_NAME_);
by SEX;
id EXDSTXT;
var DoseC_P;
run;
proc print data=EXDM;
run;

Ayooo1_0-1671041135114.png

 

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

Obviously, there are way to do this. 

 

However, if your end goal is to simply create a frequency table with percentages, then there are better ways to go.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 297 views
  • 0 likes
  • 2 in conversation