I literally can't figure this out. So I'm extremely new to sas and I'm trying to create this dataset, AGE2. I keep getting this strange error that I can't figure out the source. I have narrowed it down to just the AGE2 function thing. I'm thinking it's most likely some type of syntax error and that'll be a total facepalm moment. So I've included all my code for this part of my stuff, but I wont include all the error bc that'll be way too long. So, instead I'll just include the errors I got when running AGE2. Also idk if this is the right forum for this, lmk.
*PROBLEM 2;
DATA = AGE2;
INPUT AGE WEIGHT GENDER $;
DATALINES;
23 167 M
24 178 F
21 183 F
30 172 M
25 166 M
24 183 M
26 145 F
29 155 F
22 133 M
24 154 M
;
RUN;
PROC PRINT DATA=AGE2;
RUN;
*6;
PROC SGPLOT DATA=AGE2;
SCATTER X=AGE Y=WEIGHT;
RUN;
*7;
PROC SGPLOT DATA=AGE2;
HISTOGRAM WEIGHT;
RUN;
*8;
PROC SORT DATA=AGE2 OUT=SORTDATA2;
BY GENDER;
RUN;
PROC BOXPLOT DATA=SORTDATA2;
PLOT WEIGHT*GENDER;
RUN;
*9;
PROC SGPLOT DATA=AGE2;
HBOX AGE;
RUN;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
70
71 DATA = AGE2;
____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
72 INPUT AGE WEIGHT GENDER $;
_____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
73 DATALINES;
_________
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
74 23 167 M
__
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
75 24 178 F
76 21 183 F
77 30 172 M
78 25 166 M
79 24 183 M
80 26 145 F
81 29 155 F
82 22 133 M
83 24 154 M
84 ;
85 RUN;
86
87
88 PROC PRINT DATA=AGE2;
ERROR: File WORK.AGE2.DATA does not exist.
89 RUN;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 212.40k
OS Memory 31396.00k
Timestamp 09/22/2019 03:58:42 AM
Step Count 85 Switch Count 0
Page Faults 0
Page Reclaims 22
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
90
91 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
102
Cancel the equal sign on 1st code line.
It should be:
DATA AGE2;
INPUT AGE WEIGHT GENDER $;
DATALINES;
........
Cancel the equal sign on 1st code line.
It should be:
DATA AGE2;
INPUT AGE WEIGHT GENDER $;
DATALINES;
........
I knew it was gonna be something obvious. Thank you for the timely reply.
When you have a problem with a statement, it is always best to consult the documentation for it.
See DATA Statement. It will show you how the statement has to be used.
Also see Maxim 1: Read the Documentation.
Thank you for this. I was oblivious to that = sign. When I was scouring over the code I honestly didn't see it. Sometimes its good to get a second pair of eyes on a question and I appreciate your response.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.