Hi everyone,
I have a stored format.
proc format library=RECEIVE.DSTERM_DSDECOD ;
value DSTERM 1='Adverse Event'
2='Protocol Nonompliance'
3='Lost to followup'
4='Investigator decision'
5='patient Withdrawn consent'
6='Death'
7='Ineligible'
8='Other';
run;
i would like to assign the character parts of this format to a new variable name DSDECOD but with UPPERCASE.
I was thinking bout using upcase(), but don't know how to assign the character values to the DSDECOD variable.
Is there any other efficient way out. Kindly help.
Try DSDECOD = upcase(put(var, DSTERM.);
Try DSDECOD = upcase(put(var, DSTERM.);
If you are going to do this frequently you might consider building another format and use the one you need depending on the specific situation:
proc format library=RECEIVE.DSTERM_DSDECOD ; value DSTERMUP 1='ADVERSE EVENT' 2='PROTOCOL NONOMPLIANCE' 3='LOST TO FOLLOWUP' 4='INVESTIGATOR DECISION' 5='PATIENT WITHDRAWN CONSENT' 6='DEATH' 7='INELIGIBLE' 8='OTHER'; run;
Notice the name of the format ends in UP to differentiate the values.
Some of my variables I have multiple formats for different uses. Such as having acronym, short and long text versions.
BTW is "Nonompliance" supposed to be "Noncompliance"?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.