i have ran a code:
data us99;
set us13;
annualreportdate=tranwrd(annualreportdate,'Dec','');
run;
for some strange reason, after i get rid of Dec, I get a space between my year ie: (space)2013
how can i remove that space so that the ones that i removed Dec aligns with other year observations?
thank you!
I think there's better ways to do what you want to do...but you need to provide more details.
You can use compress to remove spaces to solve your immediate problem.
In case you would like to remove the character data from the variable, you can try the below code
data have;
annualreportdate='01Dec2013';
annualreportdate=compress(annualreportdate,,'kd');
run;
Thanks,
Jag
annualreportdate=tranwrd(annualreportdate,'Dec','');
for some strange reason, after i get rid of Dec, I get a space between my year ie: (space)2
how can i remove that space
AnnualReportDate = tranwrd( annualreportdate, 'Dec2', '2' ) ;
You might need to repeat it for the 1900s if your reports go that far back (but that seems less likely)
Use another function.
data us99; annualreportdate='Dec2014'; annualreport=prxchange('s/Dec//',-1,annualreportdate); run;
Xia Keshan
To replace to null string, length 0, you need "new" TRANSTRN function and to specify a 0 length string you need a function like TRIMN.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.