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

Hi,

While running this program , i am getting an error can any body help me out.

I am working on SAS9.1 version.

 

Code -:

 

Data char;
Input Name $ 1-50 ;
Cards;
Sandy David
Annie Watson
Hello ladies and gentlemen
Hi, I am good
;
char= compbl(Name);
Run;

 

Error :

char1 = compbl(Name);
-----
180

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

 

Can anybody help me out.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
5 REPLIES 5
collinelliot
Barite | Level 11

Your char = ... should come before the cards statement, not after.

Astounding
PROC Star

It isn't the COMPBL function ... it's where you are trying to use it.

 

Any data manipulation statements should go between the INPUT statement and the CARDS statement.  You just put it in the wrong place.

riteshkumarrai
Calcite | Level 5

Why it doesn't work when we use after cards??

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Reading the manual is always informative:

https://v8doc.sas.com/sashtml/lgref/z0188182.htm

Astounding
PROC Star

SAS executes one DATA or PROC step at a time.  To do this, it needs to determine when one step ends and the next one begins.  Most of the time, a RUN; statement tells SAS that the current step is complete.  However, a CARDS; statement also has that purpose within a DATA step.  It tells SAS that it already has all the statements that are part of the DATA step, and that the data to read in will follow.

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
  • 5 replies
  • 918 views
  • 2 likes
  • 4 in conversation