
I am trying to do these steps in this image but my code is not working very much.
Here's what I have
data medicine;
input patient date;
RETAIN date2 date9.;
datalines;
REC PATIENT DATE DATE2
1 1001 01FEB2009
2 1001 02FEB2009
3 1001 04FEB2009
4 1001 06FEB2009
5 1002 17FEB2009
6 1002 18FEB2009
7 1002 19FEB2009
8 1003 12FEB2009
9 1003 16FEB2009
10 1003 19FEB2009
;
I keep getting an error with my retain statement saying:
172 data medicine;
173 input patient date date2;
174
175
176 RETAIN date2 date9.;
______
22
201
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
a missing value, (, -, :, ;, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.
ERROR 201-322: The option is not recognized and will be ignored.
HI @Curious4 I am curious to know why you are formatting the date2 variable in a RETAIN statement?
Some homework assignments from Prof. Kurt:
😉
Finishing these tasks will advance you a lot towards a better understanding of what's happening here.
Some additional Hints:
Do not place variable names in a DATALINES block.
The first value in your data row is Rec not PatientID (left to right on Input needs to match the data lines)
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.