I cannot run this code for the life of me. I am trying to use some variables to pull data and am coming up short no matter what I try. here is the bit of code
PROC SQL;
CREATE TABLE WORK.MEMBERSHIP_TABLE AS
SELECT t1.UNIQ_ID,
t1.Year_Month_Text AS INCURRED_YYYYMM,
t2.Group
FROM WORK.THISTABLE&Paid_YYYYMM t1
INNER JOIN WORK.THATTABLE_MBRS t2 ON t1.UNIQ_ID = t2.UNIQ_ID
WHERE t1.Year_Month_Text BETWEEN &Start_YYYYMM AND &End_YYYYMM;
QUIT;
Here is the log that keep outputting, you can see my variables are correct and I promise that the columns they are associated with are character columns.
Thanks for the response Paige!! Someone answered my question though, I needed double qoutees "" on either side of the start and end variables. Fixed it right up!
Please run PROC CONTENTS on the data set WORK.THISTABLE&Paid_YYYYMM and see whether variable Year_Month_Text is character or numeric. (Don't say "I know it's numeric" or "I know its character" ... I want to know what PROC CONTENTS says)
If it is a character variable, then this could be the problem, because a character variable cannot be between the numeric integers 201901 and 201907.
When trying to create code that works with macro variables, you absolutely must first create working code without macros and without macro variables for one situation. If you can't get that to work, you will never get code to work with macro variables. Once you have working code without macros and without macro variables, then you have a good chance of getting the code to work with macro variables.
Thanks for the response Paige!! Someone answered my question though, I needed double qoutees "" on either side of the start and end variables. Fixed it right up!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.