BookmarkSubscribeRSS Feed
jc3992
Pyrite | Level 9

Hello,

 

I am just a beginner, and I want to test to write a code to use the txt. file titled "test 3" and run a SPSS result.

Please help me check what is wrong in my code. Thanks much!!

 

filename tesfil3 'myfolders/test3.txt';

data test3;
infile tesfil3;*termstr=CRLF;
input Manufacturer$ Type$ Price MPG.city MPG.highway Horsepower Origin$;
run;

proc print data=test3;
run;

3 REPLIES 3
Reeza
Super User

Ad firsobs=2 to the infile statement. 

 

And I assume you mean SAS not SPSS otherwise you’re using the wrong software. 

 


@jc3992 wrote:

Hello,

 

I am just a beginner, and I want to test to write a code to use the txt. file titled "test 3" and run a SPSS result.

Please help me check what is wrong in my code. Thanks much!!

 

filename tesfil3 'myfolders/test3.txt';

data test3;
infile tesfil3;*termstr=CRLF;
input Manufacturer$ Type$ Price MPG.city MPG.highway Horsepower Origin$;
run;

proc print data=test3;
run;


 

Shmuel
Garnet | Level 18

One more point to @Reeza's comments:

 

A dot is not permitted in a variable name:

use MPG_city instead MPG.city in your input staement, or just MPGcity.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 785 views
  • 4 likes
  • 3 in conversation