<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PROC PRINT both Labels and Variable Names OR Insert row above variable names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789690#M252746</link>
    <description>&lt;P&gt;I really like RWI, but for this task it is a bit too much. The example uses sashelp.class. Tested with SAS 9.4m5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods csvall file="class.csv";

proc odstext;
   p 'A1="ndar_subject" and B1=1';
run;

proc print data=sashelp.class noobs;
run;

ods csvall close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Jan 2022 12:48:41 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2022-01-12T12:48:41Z</dc:date>
    <item>
      <title>PROC PRINT both Labels and Variable Names OR Insert row above variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789571#M252664</link>
      <description>&lt;P&gt;For one of the research studies I work on, we are meant to upload data to the National Data Archive (NDA). To this end, in SAS 9.4 we are trying to create several CSV files - one for each of the survey instruments used in our interviews. NDA uploads require a row at the top of the file with information for their system to read in (in this case,&amp;nbsp;&lt;SPAN&gt;A1="ndar_subject" and B1=1), the second row is the variable names, and the rest is the data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;One solution I hoped for would be to print data labels AND variable names, where we assign variable1="ndar_subject" and variable2="1" for labels and leave the rest blank. We tried using a title statement in conjunction with ODS CSVALL, but that only provided us with the cell A1 requirement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Another thought would be to somehow insert a row into the CSV with&amp;nbsp;A1="ndar_subject" and B1=1 and then continue with a PROC PRINT.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any solution suggestions are welcome!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 19:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789571#M252664</guid>
      <dc:creator>jeanderson</dc:creator>
      <dc:date>2022-01-11T19:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT both Labels and Variable Names OR Insert row above variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789650#M252719</link>
      <description>&lt;P&gt;I'd use the data step's ODS object &lt;A href="https://support.sas.com/resources/papers/proceedings13/040-2013.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings13/040-2013.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 08:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789650#M252719</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2022-01-12T08:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT both Labels and Variable Names OR Insert row above variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789690#M252746</link>
      <description>&lt;P&gt;I really like RWI, but for this task it is a bit too much. The example uses sashelp.class. Tested with SAS 9.4m5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods csvall file="class.csv";

proc odstext;
   p 'A1="ndar_subject" and B1=1';
run;

proc print data=sashelp.class noobs;
run;

ods csvall close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jan 2022 12:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789690#M252746</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-01-12T12:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT both Labels and Variable Names OR Insert row above variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789694#M252748</link>
      <description>Check FILE statement 's option HEADER= .         &lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lestmtsref/n15o12lpyoe4gfn1y1vcp6xs6966.htm#n1o7sd9tt122s7n1paohutxn0m5v" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lestmtsref/n15o12lpyoe4gfn1y1vcp6xs6966.htm#n1o7sd9tt122s7n1paohutxn0m5v&lt;/A&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789694#M252748</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-12T13:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT both Labels and Variable Names OR Insert row above variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789874#M252822</link>
      <description>&lt;P&gt;Writing a CSV file is trivial so writing an extra line at the top of it is going to be very easy.&amp;nbsp; But it is not at all clear what you mean.&lt;/P&gt;
&lt;P&gt;What you seem to be describing is a file like this:&lt;/P&gt;
&lt;PRE&gt;"A1=""ndar_subject""",B1=1
var1,var2
A,1
B,2
C,3&lt;/PRE&gt;
&lt;P&gt;But somehow that seems not reasonable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show an example of the file want to create.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how you could make a CSV file from SASHELP.CLASS with an extra line at the top with any text you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename csv 'myfile.csv';
data _null_;
  file csv;
  put 'This is the header row';
run;
proc transpose data=sashelp.class(obs=0) out=names;
  var _all_;
run;
data _null_;
  file csv dsd mod;
  set names;
  put _name_ @;
run;
data _null_;
  file csv dsd mod;
  set sashelp.class;
  put (_all_) (+0);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;This is the header row
Name,Sex,Age,Height,Weight
Alfred,M,14,69,112.5
Alice,F,13,56.5,84
Barbara,F,13,65.3,98
Carol,F,14,62.8,102.5
Henry,M,14,63.5,102.5
James,M,12,57.3,83
Jane,F,12,59.8,84.5
Janet,F,15,62.5,112.5
Jeffrey,M,13,62.5,84
John,M,12,59,99.5
Joyce,F,11,51.3,50.5
Judy,F,14,64.3,90
Louise,F,12,56.3,77
Mary,F,15,66.5,112
Philip,M,16,72,150
Robert,M,12,64.8,128
Ronald,M,15,67,133
Thomas,M,11,57.5,85
William,M,15,66.5,112
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 03:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-PRINT-both-Labels-and-Variable-Names-OR-Insert-row-above/m-p/789874#M252822</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-13T03:15:10Z</dc:date>
    </item>
  </channel>
</rss>

