BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I am using a piece of code to convert dataset to csv in my EG project

Code:

%ds2csv (data=WORK.QUERY_FOR_QUERY9263, runmode=b, csvfile=/apps/sas/ReportsRepository/Reports/BSS/BMA/CSV/Monthly/BM_SREP0038_StkVal_&date1..csv,openmode=REPLACE);

In the same project I am creating a text file through proc report by having outfile in my code and I have specified ls=256.

The CSV file which is created the last column label gets truncated since its going above 256 length when all columns together.

Below is the CSV File
If u see the column header Tot is displayed Instead of Total becoz of that
the first row is displayed on the level of column header.
Any solution to avoid this


"Branch No","Branch Name","Main Stock","Damaged Stock","Quarantine","Return to supplier","Trade Counter Display","Supplier Consignment","Co- managed Inventory","Customer Consignment","Goods In","Off site","Total Of XYZ Stock","Total Of Non XYZ Stock","Tot
"1110","1110 abc","1,635,407.02","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","1,635,407.02","0.00","1,635,407.02" Message was edited by: Sunil Gandhi
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi...some of those old macros did respect line size limitations -- which is just one of the reasons why I wouldn't use them anymore. They are left over from Version 6 and Version 8. ODS generally ignores linesize for non-listing destinations (like CSV, HTML, RTF, etc).

Try:
[pre]
ods csv file="/apps/sas/ReportsRepository/Reports/BSS/BMA/CSV/Monthly/BM_SREP0038_StkVal_&date1..csv";
proc print data=work.query_for_query9263;
run;
ods csv close;

[/pre]
And see whether you run into the same limitation...I don't think you will. Otherwise, you might consider contacting Tech Support. There are other ways to create CSV files from SAS datasets, but I think the ODS method will work for you.

cynthia
deleted_user
Not applicable
Thanks a lot.
It worked.

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
  • 2 replies
  • 945 views
  • 0 likes
  • 2 in conversation