BookmarkSubscribeRSS Feed
shimelis
Calcite | Level 5

Hello Sas community; /* gives a summary of a variable age */ Every time I run this code,it gives an error saying VAR AGE IS OUT OF ORDER.

 

 PROC MEANS DATA = sun.demographics NWAY MISSING; 
N NMISS MEAN MIN P1 P5 P10 P25 P50 P75 P90 P95 P99 MAX;
 VAR AGE;;
 RUN;

 

Where as when I run this code , it gives an output.:

PROC MEANS DATA = sun.demographics NWAY MISSING;
 VAR AGE;; 
RUN; 

 

Please can somebody explain why the first code keeps giving me an error? with Regards!

4 REPLIES 4
ballardw
Super User

The code that doesn't run:

 PROC MEANS DATA = sun.demographics NWAY MISSING; N NMISS MEAN MIN P1 P5 P10 P25 P50 P75 P90 P95 P99 MAX;

Has a ; after missing. That ends the Proc means statement.

 

You are likely misunderstanding that an error message like:

ERROR 180-322: Statement is not valid or it is used out of proper order.

 

Is actually referring to the line Above where the message appears in the log. There should be an underscore under the N. That indicates that the place you referred to the N statistic is incorrect.

 

Astounding
PROC Star

In addition to the extra semicolon, note that the message you got is consistent with your actual program containing this statement:

 

BY AGE;

 

If that statement appears in the code, it needs to come out.  The VAR statement is correct.

shimelis
Calcite | Level 5
Hello SAS community; /* gives a summary of a variable age */ Every time I run this code one, it gives an error saying VAR AGE IS OUT OF ORDER. Code1 PROC MEANS DATA = sun.demographics NWAY MISSING; N NMISS MEAN MIN P1 P5 P10 P25 P50 P75 P90 P95 P99 MAX; VAR AGE; RUN; Whereas when I run this code2, it gives an output. Code2 PROC MEANS DATA = sun.demographics NWAY MISSING; VAR AGE; RUN; Please, can somebody explain why the first code keeps giving me an error? with Regards!
ballardw
Super User

Please post your code using the input box opened by  "running man" icon on the top row. Your unformatted code is very hard to read.

And the question has been answered.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1022 views
  • 5 likes
  • 3 in conversation