BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ykk
Obsidian | Level 7 ykk
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
ykk
Obsidian | Level 7 ykk
Obsidian | Level 7

I had updated the code to use trim() while concatenating the 2 variables.I am getting the output correctly now.

View solution in original post

2 REPLIES 2
Reeza
Super User

change the length of the Test variable at the top of your code:

length mar $20.;

msr='TEST';


.... remaining sas code

ykk
Obsidian | Level 7 ykk
Obsidian | Level 7

I had updated the code to use trim() while concatenating the 2 variables.I am getting the output correctly now.

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1655 views
  • 3 likes
  • 2 in conversation