Desktop productivity for business analysts and programmers

Raw Data File

Reply
Contributor
Posts: 73

Raw Data File

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

Super User
Posts: 1,117

Re: Raw Data File

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
Contributor
Posts: 73

Re: Raw Data File

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.

Community Manager
Posts: 2,697

Re: Raw Data File

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

Super User
Posts: 1,117

Re: Raw Data File

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
Ask a Question
Discussion stats
  • 4 replies
  • 255 views
  • 0 likes
  • 3 in conversation