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

Dear all,

I am a very beginner of a SAS self learner. I have used libname to define the Practice library in SAS studio and tried to read a txt file saved in drive E: with following statements. However I got the error message as below:

%let path=E:\SAS\DA practice data - Original

data Practice.b_sales;

   infile "&path/b_sales.txt" dlm=' ';

   input purchase age gender $ income $;

run;

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

Anyone could help me explain what's wrong and how I can correct it?

Thank you very much!

Cathy

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Your file separator is different .

E:\SAS\DA  -->  is \

"&path/b_sales.txt"   -->  is /

That is the reason why SAS complain it .



Xia Keshan

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

Your %LET statement appears to be missing a semicolon. This means that the first statement in your program is:

%let path=E:\SAS\DA practice data - Original data Practice.b_sales;

I suspect it is your INFILE statement that is getting the 180 error as it doesn't have a preceding DATA statement as it has become part of the text in your %LET statement.

cathychen0615
Calcite | Level 5

Thank you very much for your help! Smiley Happy

Ksharp
Super User

Your file separator is different .

E:\SAS\DA  -->  is \

"&path/b_sales.txt"   -->  is /

That is the reason why SAS complain it .



Xia Keshan

cathychen0615
Calcite | Level 5

Hello Xia,

Thank you very much for your great help! Smiley Happy

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 783 views
  • 3 likes
  • 3 in conversation