BookmarkSubscribeRSS Feed
Aadhya2016
Calcite | Level 5

Hello,

I have SAS enterprise guide verison 7.12 installed and server is connected. I need to use comma delimited txt file from SASapp using the server directory. I could access that txt file in server.  In order to use that txt file, do I need to use infile, input and datalines option? How do I proceed to use data and proc step?

 

Thank you for your help in advance

Samrita

4 REPLIES 4
Aadhya2016
Calcite | Level 5

Thank you for reply,

data is under this file suppTRP-1062.txt and data looks like follows:

J,08,2,1,02/08/1998,74,280

J,11,1,,12/14/1997, 66, 169

 

so if I want to create new data SET called STUDY  using this file, can I use this code,

data work.suppTRP-1062;

   SET STUDY;

lenght Site $1 PT $2

Datalines;

J,08,2,1,02/08/1998,74,280

J,11,1,,12/14/1997, 66, 169

;

RUN;

 

Regards,

Samrita

 

 

Kurt_Bremser
Super User

You seem to not have read my post. You either use datalines and data internal to the data step, or infile and an external file.

 

In the data statement, you name the dataset that is to be created. A set statement names an existing dataset thst us to be read, so you don't need that statement. Use input to read variables.

 

Study the documentation for all these statements to get a clue.

rogerjdeangelis
Barite | Level 11

If you use the 'old text editor'  and the csv file is at c:\temp\tmp.csv

 

Then this code will create class.sas7bdat from the csv

 

dm "dimport 'c:\temp\tmp.csv' class  replace";

 

You can also type

 

dimport 'c:\temp\tmp.csv' class  replace

 

on the clean 'command line'

 

This does not work in EE, EG, UE, SAS Stiudio, On demand,.

 

EE does not have a command line that supports SAS scripting like home, cursor or store.

SAS Innovate 2025: Register Now

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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1350 views
  • 0 likes
  • 3 in conversation