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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1442 views
  • 4 likes
  • 3 in conversation