I had written the below code
msr='TEST';
count =1;
if COALESCE(NEW_GLOBAL_MIN,EXISTING_GLOBAL_MIN) eq . then
do;
msr = msr||'GLOBAL_MIN';
count = count+1;
put msr;
put 'inside 1 if';
end;
if COALESCE(NEW_GLOBAL_MEDIAN,EXISTING_GLOBAL_MEDIAN) = . then
do;
msr = msr||',GLOBAL_MEDIAN';
PUT msr;
count = count+1;
end;
if COALESCE(NEW_GLOBAL_MAX,EXISTING_GLOBAL_MAX) = . then
do;
msr = msr||',GLOBAL_MAX';
PUT msr;
count = count+1;
end;
if COALESCE(NEW_LOCAL_MIN,EXISTING_LOCAL_MIN) = . then
do;
msr = msr||'LOCAL_MIN';
PUT msr;
count = count+1;
end;
if COALESCE(NEW_LOCAL_MEDIAN,EXISTING_LOCAL_MEDIAN) = . then
do;
msr = msr||',LOCAL_MEDIAN';
PUT msr;
count = count+1;
end;
if COALESCE(NEW_LOCAL_MAX,EXISTING_LOCAL_MAX) = . then
do;
msr = msr||',LOCAL_MAX';
PUT msr;
count = count+1;
end;
put msr;
put count;
Once this is executed in the end I am expecting values 'TEST GLOBAL MIN GLOBAL MEDIAN ...'etc but I can see only TEST in the log when I print the variable msr at the end.But the value of count is 7 which confirms that all the code in the 6 if statements is executed.
Can you please help me in fixing the above issue.
Thanks
Kiran
I had updated the code to use trim() while concatenating the 2 variables.I am getting the output correctly now.
change the length of the Test variable at the top of your code:
length mar $20.;
msr='TEST';
.... remaining sas code
I had updated the code to use trim() while concatenating the 2 variables.I am getting the output correctly now.
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 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.