Hi,
I was wondering if anyone can help with my code. I'm new to coding so I apologize if this is a dump question. I keep getting the following notes in my code and I'm not sure how to fix it.
Here is the log:
Is the variable START numeric? Because the way your code is written, it must be character; if it really is numeric then that would explain the NOTEs in the LOG.
How is this different than your question yesterday? It's literally the exact same notes.
https://communities.sas.com/t5/SAS-Programming/Coding-Help/m-p/518938
You need be more careful in what variables you are referencing.
Take this little block of code:
271 ** Create new variable that contains numeric values of s_cmstdtc; 272 ** If the first character of s_cmstdtc is 'U', leave numeric value missing; 273 274 format sort date9.; 275 sort = input(s_cmstdtc, ??date9.); 276 if upcase(substrn(sort,1,1))= "U" then sort = .;
You convert the characters in S_CMSTDTC into a date value in SORT. But then try to use a character function on the numeric variable SORT. Didn't you mean to check S_CMSTDTC? Also shouldn't you check it BEFORE trying to convert it to a date?
But even easier just delete the last line since the assignment statement above it will have already converted strings that are not valid dates (including strings that start with the letter U) to missing values.
Also look at this block of code earlier
263 ** Create new variable for s_cmtrt; 264 if (s_cmtrt ne ' ') then medname = Medication; 265 else if (s_cmtrt eq ' ') then Medication = 'None';
The comment mentions only one input variable, but the IF statement is reading from some other variable named MEDICATION. Then the ELSE statement will modify that MEDICATION variable, but do nothing with the MEDNAME variable. Did you mean to change the MEDICATION variable? Did you mean to not set the MEDNAME variable to anything? Is it a new variable or an existing variable that is being read in from the source dataset?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.