12-28-2017 03:21 AM
Your question requires more details before experts can help. Can you revise your question to include more information?
Review this checklist:
To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message. From there you can adjust the title and add more details to the body of the message. Or, simply reply to this message with any additional information you can supply.
SAS experts are eager to help -- help them by providing as much detail as you can.
This prewritten response was triggered for you by fellow SAS Support Communities member @KurtBremser.
12-28-2017 07:17 AM - edited 12-28-2017 07:22 AM
Create a macro that includes a dataset that contains observations with a date variable containing dates for March, 2017. Assign the month name to one macro variable and year number to another macro variable. Output a CSV file where the resulting file name includes value of the two macro variables within the name. Eg: “Filename_March_2017.csv”
Yes, of course SAS can create these macro variables. It's probably not a good idea to use “Filename_March_2017.csv”, because this won't sort properly, it will sort alphabetically in your operating system. A better result would be to “Filename_2017-03.csv”, which will sort properly in your operating system.
Something like this, assuming ALL date values in your data set are in the same month (UNTESTED CODE)
data _null_; set have(obs=1); call symputx('year_month',put(date,yymmd7.)); run;