BookmarkSubscribeRSS Feed
noobs
Calcite | Level 5

How do I go about creating raw data file in SAS Enterprise Guide?

Later I intend to use INFILE statement and INPUT to access this file and its contents.

Is it even possible to do so?

Regards,

Dhanashreeata

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

Hope this is what you were expecting

data _null_;

    file "E:\source\test.txt" print;

    input name$ age;

    if _n_=1 then put @1 "name" @10 "age";

    put @1 name  @10 age;

cards;

alice 30

william 20

;

run;

Thanks,

Jagadish

Thanks,
Jag
noobs
Calcite | Level 5

Yes, that is what I am looking for. Although .dat extension. So after I have created that file, I am having following script to access its contents and generate data set:

filename testref "/home/dhanashree.gadka/user/DUG/test.dat";

data work.vegd;

     infile testref;

     input vname $ vfreq $;

run;

I see this error in Log:

ERROR: Invalid logical name.

ERROR: Error in the FILENAME statement.

ERROR: Physical file does not exist, /sso/biconfig/930/Lev1/SASApp/TESTREF.

Am I missing something?

And in theory, what is the best way to peek at raw data files for data examination purposes so that one can figure out what is the data structure and how to write the input statements.

Thanks so much.

ChrisHemedinger
Community Manager

From the log, it looks like you are using a SAS installation that hosted with SAS OnDemand.  Is that correct?  If so, be sure to consult the appropriate guidance for how to access/create external files in this environment.

With SAS Enterprise Guide, you can easily discover the structure of a text-based data file by opening it with File->Import Data.  The Import Data task will generate a DATA step with INPUT statements to read your file structure.

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Jagadishkatam
Amethyst | Level 16

i believe the code is correct.

Need to check the path. Also please try to give a different filename, instead of testref try testr. Though testref should also work, but since it is throwing an error try to replace the name.

Thanks,

Jagadish

Thanks,
Jag

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!

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