Reading a data file into SAS. 1st 2 datalines are as follows:
1 New York 07/19/1966 05/10/2015 107 No
2 New Jersey 11/10/1964 . 130 Yes
Code I've written:
DATA Homwrk1;
INFILE '/folders/myfolders/hw1_data.txt';
INPUT @1 ID SITE $ 5-14 @20 DOB @35 START @50 GLUCOSE @57 DIABETES $;
INFORMAT DOB START MMDDYY10.;
RUN;
Output on date variables is giving me days before/since Jan 1, 1960. Isn't INFORMAT supposed to correct this?
Thanks in advance -
No. Informat tells SAS how to read data. The FORMAT statement tells SAS how to display variable values.
Art, CEO, AnalystFinder.com
Thank you!
When posting data, use the window opened with the {i} button. The main posting window compresses whitespace (blanks, tabs), so the data as posted does not match your input statement at all.
Similarly, use the "little running man" for code. This keeps the code "as is" and adds coloring like the Enhanced Editor.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: