I have two variables
one is named yr and is an integer e.g. 2017
and one called quarter taking values Q1, Q2, Q3 etc.
How can I produce a variable called Time which contains YearQuarter concatenated e.g. 2017Q1 etc?
I tried this:
rsubmit;DATA dataset_1;SET dataset_1;Time=cat(yr, quarter);RUN;endrsubmit;
but it returns empty values
Works fine?
data test; yr=2017; quarter='Q1'; time=cat(yr, quarter); run;
Pleas provide more details as this code works fine
data dataset_1; input yr quarter $; Time=cat(yr, quarter); datalines; 2017 Q1 2017 Q2 2017 Q3 ; run;
Can you post your reply with variables names insted of using datalines?
@ed_sas_member 's reply DOES have variable names. The datalines approach is used instead of SET statements to show you that the CAT functions works - you can compare the result to the original variables YEAR and QUARTER.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
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.