BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
art297
Opal | Level 21

DN: I added that because of the following line in the documentation: "Note:   The order in which variable names are returned by CALL VNEXT can vary in different releases of SAS and in different operating environments." Ref: SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

Tom
Super User Tom
Super User

Using ODS CSVALL to create a data dump is probably not what you want. That is for storing a report output.

You should NOT be seeing extra blank lines if you use PROC EXPORT.

But converting a dataset to a CSV file is so easy with base SAS code there is no need to use either of those tools.

%let csvfile=%sysfunc(pathname(work))\class.csv;

proc transpose data=sashelp.class(obs=0) out=names;

  var _all_;

run;

data _null_;

  set names ;

  file "&csvfile" dsd dlm=';' lrecl=30000 ;

  put _name_ @;

run;

data _null_;

  set sashelp.class ;

  file "&csvfile" dsd dlm=';' lrecl=30000 MOD ;

  put (_all_) (:) ;

run;


You can check it with a simple data step to read in the file and dump it to the log.


data _null_;

  infile "&csvfile";

  input;

  list;

run;

jakarman
Barite | Level 11

I am also not data_null_ . I used his code to read it back in binary mode for 5 observations.

That first tree chars EF BB BF is the Bom indicator. SAS is having an issue to show these as char shifting the line 3 chars.

I also opened the file in notepad++ there is no data on the 7-th line the cursor is unmovable.

Reading it back with SAS it also states there are only 6 lines (5 added to the header)

I am missing the ctrl-z character (1A) that is often used as EOF marker.Substitute character - Wikipedia, the free encyclopedia no problem

All looks well there is no additional blank line although your viewer might think so.

data _null_;

  infile test(FT66F001) encoding=latin1 recfm=n lrecl=32767;

  input name $32767. ;

  list;

run;

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                    

1   CHAR  Name;Sex;Age;Height;Weight..Alfred;M;14;69;112.5..Alice;F;13;56.5;84..Barbara;F;13;65.3;98..Carol

     ZONE  EBB4666356734663466667356666700466766343333333333230046666343333332333300467667634333333233330046766

     NUMR  FBFE1D5B358B175B859784B759784DA1C6254BDB14B69B112E5DA1C935B6B13B56E5B84DA2122121B6B13B65E3B98DA312FC

      101  ;F;14;62.8;102.5..Henry;M;14;63.5;102.5.. 141

     ZONE  34333333233333230046677343333332333332300

     NUMR  B6B14B62E8B102E5DA85E29BDB14B63E5B102E5DA

---->-- ja karman --<-----
Ksharp
Super User

If I understood what you mean , here is an example.

 

 
filename FT66F001 'c:\temp\sashelp.csv' ; 

data _null_; 
   set sashelp.class end=last;
   file FT66F001 dsd encoding=utf8 delimiter=';'   recfm=n; 
   put name $10.  ;
   if not last then put '0D0A'x ;
   run; 

Xia Keshan

Message was edited by: xia keshan

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 18 replies
  • 6392 views
  • 6 likes
  • 7 in conversation