BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sunbear
Fluorite | Level 6

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        
1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

Cancel the equal sign on 1st code line.

It should be:

DATA  AGE2;
INPUT AGE WEIGHT GENDER $;
DATALINES;
........

 

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

Cancel the equal sign on 1st code line.

It should be:

DATA  AGE2;
INPUT AGE WEIGHT GENDER $;
DATALINES;
........

 

sunbear
Fluorite | Level 6

I knew it was gonna be something obvious. Thank you for the timely reply.

Kurt_Bremser
Super User

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.

sunbear
Fluorite | Level 6

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. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1188 views
  • 1 like
  • 3 in conversation