BookmarkSubscribeRSS Feed
marmst10
Calcite | Level 5

This is the first few rows of my data

 

0002C00001IVR12025VS1111111111   0.C
0002C00001IVR32053VS1111111111   0.C
0002C00001LGR125408V1111111111   0.C
0002B00001UBDS2126PD1111111111   0.C
0002C00001UBDS2126PD1111111111   0.C
0002B00001UBDS2465PD1111111111   0.C
0002C00001UBDS2465PD11111111112   0.C
0002C00001UBDS2670PD1111111111   0.C
0002B00001UBDS2678PD1111111111   0.C
0002C00001UBDS2678PD1111111113   0.C
0002B00001UBDS2G50121111111116   0.C

 

This is my code for the export

 

proc export data = class.merged_n /*Export merged_n as a csv*/
outfile = 'C:\...\merged_n.csv'
dbms = csv
replace;
run;

 

This is the output, from notepad. Opening in excel it says "File not loaded completely"


0002,C,00001,IV,R1,2,025VS,1111111
1,1,,,,0,,C
0002,C,00001,IV,R3,2,053VS,1111111
1,1,,,,0,,C
0002,C,00001,LG,R1,2,5408V,1111111
1,1,,,,0,,C
0002,B,00001,UB,DS,2,126PD,1111111
1,1,,,,0,,C
0002,C,00001,UB,DS,2,126PD,1111111
1,1,,,,0,,C
0002,B,00001,UB,DS,2,465PD,1111111
1,1,,,,0,,C
0002,C,00001,UB,DS,2,465PD,1111111
1,12,,,,0,,C
0002,C,00001,UB,DS,2,670PD,1111111
1,1,,,,0,,C
0002,B,00001,UB,DS,2,678PD,1111111
1,1,,,,0,,C
0002,C,00001,UB,DS,2,678PD,1111111
1,3,,,,0,,C
0002,B,00001,UB,DS,2,G5012,1111111
1,6,,,,0,,C
0002,C,00001,UB,DS,2,G5012,1111111
1,45,,,,0,,C

 

You can see the unexpected carriage returns. How to remedy this?

 

Thanks in advance

 

2 REPLIES 2
Reeza
Super User
file not loaded in Excel may be due to the size of the file, Excel 2007 and prior (32 bit) has a 64K row limit and Excel 2010+ has a 1 million row limit.

You can use COMPRESS() and the carriage return ('0A'x I believe) to remove the character from your data.
Tom
Super User Tom
Super User

PROC EXPORT is not going to insert any extra line breaks.  If there are LineFeeds ('0A'x) or CarrriageReturns ('0D'x) in the output then they are in the input.

 

Are you sure the data you posted are the same?  The first appears to have more variables than the second.  In particular look at the first observation of each. Notice how there are three cells in a row with '1' in them in the table you posted.  But in the text you posted the first two lines have only one cell with '1' in it.

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1573 views
  • 1 like
  • 3 in conversation