I need to convert a character variable which is in the format of '200905' (i.e., year and month) to a sas date format YYMMDw. which keeps the year and month
Degree_Term=input(TERM_DEG_GRANT, YYMMD7.)
I keep getting error message in sas log: The informat YYMMD was not found or could not be loaded.
Anyone can help me how to modify the code? Thanks!
To convert text to values you need to use an INFORMAT. Formats are for converting values to text.
There is no informat with that name.
There is on named YYMMN that will read strings with just year and month. The returned date will be the first day of the month.
The message is pretty clear:
The informat YYMMD was not found or could not be loaded.
This informat does not exist. You cannot make up informat names that don't exist.
For the string you have, the informat to use is yymmn. as explained above.
@ChrisNZ wrote:
The message is pretty clear:
The informat YYMMD was not found or could not be loaded.
This informat does not exist. You cannot make up informat names that don't exist.
For the string you have, the informat to use is yymmn. as explained above.
Unless you write the code yourself ...
Not interested in writing many custom date informats though.😏
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.