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