Hi,
I have asked similar question regarding formats earlier..
How can I create a charecter variable DISP shown below with a specific length for example length=2
DISP=put(DischargeDispositionkey,dispkey.);
Thanks
By using the length statement:
length DISP $2;
Not entirely sure what your question is, perhaps provide test data in the form of a datastep and required output.
Thanks for the reply.
DISP=put(DischargeDispositionkey,dispkey2.);
cant I use like this while the format is being applied itself???
Thanks
I can't remember from top of my head (I avoid using formats), this is a user format yes? You can try it, but I believe the format itself is just a display thing and length doesn't affect user formats. You could of course do:
DSIP=substr(put(DischargeDispositionkey,dispkey.),1,2);
You absolutely can do this. That's the reason that is illegal to name a user-defined format ending with a number. It gives you the flexibility to add the width later, when using the format.
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.