Hello team,
I can't fix this and it keeps giving me errors. I have worked on this for a long time.
proc summary nway missing data=somename.allofthem;
(where = (MBR_STATE="CA"));
var cnt pos neg;
class Mbr_State;
output out=result_by_state (drop=_TYPE_ _FREQ_) sum=;
run;
2970 proc summary nway missing data=somename.allofthem; 2971 (where = (MBR_STATE="CA")); _ 180 170 The SAS System 14:38 Friday, March 24, 2023 ERROR 180-322: Statement is not valid or it is used out of proper order. 2972 var cnt pos neg; 2973 class Mbr_State; 2974 output out=result_by_state (drop=_TYPE_ _FREQ_) sum=; 2975 run;
Regards,
blue
Your where clause is a data set option. So delete the semicolon in front of it.
Make up your mind.
Either use the WHERE= dataset option.
proc summary nway missing data=somename.allofthem(where = (MBR_STATE="CA"));
Or use a WHERE statement.
proc summary nway missing data=somename.allofthem;
where MBR_STATE="CA";
proc summary nway missing data=somename.allofthem;
where MBR_STATE="CA";
this gives errors.
@GN0001 wrote:
proc summary nway missing data=somename.allofthem; where MBR_STATE="CA";
this gives errors.
How many times do we have to recommend that when you have errors that you copy the code with the error text and paste it into a text box?
Hello,
I placed it in a text box. It is in a grey text box. Or I can’t understand what you mean.
I took out semicolon from proc summary and the log still shows that I have placed semicolon after proc summary,
This is what I have: Proc summary…. Var…….; Class; Where….; Run; The log shows that I have ; after proc summary while I deleted ;
Open the log window. Mark the complete text from the beginning of the procedure to the final message. Copy it to the clipboard. Open a window here with the </> button. Paste the clipboard contents into it.
@GN0001 wrote:
Please go to very first post. You will see that I placed the log.
Thanks
Blue
You were told where the mistake in that code was. Since you still get an ERROR, we need to see the log from the current code you submit.
proc summary data=sashelp.class where Age = 12; class sex; var Height; output out=class sum=sum; run; proc print data=class; run; data test1; set sashelp.class; run;
The result that I get from this program doesn't seem correct. I assume proc summary can't take a where clause. Just I would like to gain confirmation.
Thanks
a peach on a tree!
Yes you can. Correct your syntax error (missing semicolon):
proc summary data=sashelp.class;
where Age = 12;
class sex;
var Height;
output out=class sum=sum;
run;
SAS 101: SAS statements start with a key word and end in a semicolon.
You can use a where STATEMENT with PROC SUMMARY, just like with almost every other PROC.
But you forgot to end your PROC statement before you started the WHERE statement.
proc summary data=sashelp.class;
where Age = 12;
class sex;
var Height;
output out=class sum=sum;
run;
If you never end the PROC statement then is going to try to treat WHERE and AGE as additional syntax on the PROC SUMMARY statement. Neither WHERE or AGE are valid parts of the PROC SUMMARY statement.
Hello,
thanks for the response. I put semicolon after proc summary, it gives error, really I have changed the location of where and started placing semicolon after proc and then I took it, but no success.
I have be been doing this for three days and no success.
Originally the code was like this:
proc summary ….;
var…..;
class….;
where….;
run;
I was running this code for more than two years but all of sudden the word were changed to red and I change the place of where and it edited the code as below:
proc summary….;
where….;
var….;
clas…..;
run;
no success
I am going crazy!
any tips?
thanks,
blue
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.