Help using Base SAS procedures

Coverting SAS datasets into .txt files and Vice versa

Reply
Occasional Contributor
Posts: 12

Coverting SAS datasets into .txt files and Vice versa

Hi All,

Question  A

I have situation where i need convert the SAS datasets into the flat files irrespective how many varaiables or how much data it has . ( i am trying out in such a way that if i give dataset name it should convert the data into flat file)

"One observation should be read as single like example i am going to assign varchar(3000)  so on."

Question  B

Coverting the flat file into the sas dataset even in this case also i am not about the size but should read the variables and coloums data.

Any help would really be apprciated .. I am trying out from end as well.

MVK

Super User
Posts: 5,256

Re: Coverting SAS datasets into .txt files and Vice versa

I'm not sure about your requirements, but try to start with PROC EXPORT/IMPORT, and see if they can do what you need.

Data never sleeps
PROC Star
Posts: 1,091

Re: Coverting SAS datasets into .txt files and Vice versa

Check out Chris' blog posting. Either you can use his Enterprise Guide task, or it may give you some ideas to do it yourself.

Tom

http://blogs.sas.com/content/sasdummy/2013/01/21/turn-your-data-set-into-a-data-step-program/

Occasional Contributor
Posts: 12

Re: Coverting SAS datasets into .txt files and Vice versa

Just for understanding this what i am looking at

mydataset has following observation in that.

First_name Last_name  Enumber

Mike          Dell               1234

when i read the data into flat file i want it this way

First_name,Last_name,Enumber

Mike,Dell,1234

This what i am looking for??

Any help on this is apprciated.

MVK

Super User
Posts: 5,256

Re: Coverting SAS datasets into .txt files and Vice versa

PROC EXPORT!

Data never sleeps
PROC Star
Posts: 1,091

Re: Coverting SAS datasets into .txt files and Vice versa

Yes, the format that you are showing is termed "csv", for comma-separated-values. This is easy do to with SAS. As Linus suggests, check out PROC EXPORT.

Tom

Valued Guide
Posts: 2,175

Re: Coverting SAS datasets into .txt files and Vice versa

and if you don't like proc export

data _null_ ;

file 'your.csv' dsd lrecl=30000 ;

set your.data ;

put (_all_)(Smiley Happy ;

run ;

Probably a good idea also to write the proc contents output data set into a matching csv

Then the reciever of the data has an idea about the datatypes.

Ask a Question
Discussion stats
  • 6 replies
  • 258 views
  • 0 likes
  • 4 in conversation