BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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.

Ronein_0-1712661651805.png

 

 

 

 

 

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
yabwon
Onyx | Level 15

Besides what @PaigeMiller already advised you, it looks like you have an Excel table already generated. How about importing it?

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Tom
Super User Tom
Super User

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?

Ksharp
Super User
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;

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 857 views
  • 0 likes
  • 6 in conversation