BookmarkSubscribeRSS Feed
Akash93
Fluorite | Level 6

Hi Team,

 

We have developed stored procedure to download data dump in text file with below code.

 

proc export data=data_download outfile="path" file =_webout

dbms=tab replace;

run;

 

In output last 11 column names are getting excluded. Means row 1st is blank for these 11 columns and data is flowing for these columns.

 

I am attaching sample for reference. Please help if there is any solution.

 

Regards,
Akash

1 REPLY 1
Tom
Super User Tom
Super User

Why did you attach an XLSX file to your question when the SAS code in the question was generating a TEXT file?

 

PROC EXPORT might have trouble with header lines that are too long.  I know PROC IMPORT does.

 

Fortunately writing a simple text file does not need a PROC.  The DATA step can do it by itself.  But adding the header line is adds a little complication. 

 

* Write header row ;
proc transpose data=data_download(obs=0) out=names;
  var _all_;
run;
data _null_;
  file _webout dsd dlm='09'x lrecl=1000000;
  set names;
  put _name_ @;
run;

* Append data rows;
data _null_;
  file _webout dsd dlm='09'x lrecl=1000000 mod;
  set data_download;
  put (_all_) (+0);
run;

 

If you have trouble writing it directly to the _WEBOUT fileref then create a physical file first and copy it.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 531 views
  • 0 likes
  • 2 in conversation