Hello
What is the way to create the following data set with 6 columns M1-M6 with numeric number (represent date in format YYMM).Please note that I need it because the data sets tables have YYMM name and when I run macro later I need to mention to which data sets use.
This is essentially the same as your other question, where you want macro variables that have these values. The only difference is that here you would have to loop in a data step, whereas when you want macro variables you can do the looping in a data step with CALL SYMPUTX or with a macro loop.
I already explained how to do it in your other thread.
Besides what @PaigeMiller already advised you, it looks like you have an Excel table already generated. How about importing it?
Bart
The YYMMN4. format will display a date value in this way; use it in a PUT function. Calculate the dates with INTNX.
It is not clear what you mean (and posting a photograph does not help).
Do you want a DATE value with a display format like YYMMN4. format attached that will display the dates with just the last two digits of the year and two digit month number?
Do you want an INTEGER value like 2,404 with no format (or perhaps the 4. format) attached so it prints like 2404?
And please explain in more detail WHY you need this dataset? What exactly are you going to do with it?
Are you planning to combine it with actual data? What does that data look like? How do you plan to combine them?
data want;
array M{6};
start=mdy(7,1,2019);
do month=0 to 34;
do n=1 to dim(M);
M{n}=intnx('month',intnx('month',start,month),n);
end;
output;
end;
keep m1-m6;
format m1-m6 yymmn4.;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.