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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.