<?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: varibale names when using _null_  dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952523#M372261</link>
    <description>&lt;P&gt;Use PROC PRINT and you get it in the Output window.&lt;/P&gt;
&lt;P&gt;If you want to see the names in the log, use this as the first statement in the step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _n_ = 1 then put "name sex age height weight";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(adjust positions as needed)&lt;/P&gt;</description>
    <pubDate>Wed, 04 Dec 2024 11:50:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-12-04T11:50:03Z</dc:date>
    <item>
      <title>varibale names when using _null_  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952518#M372256</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    set sashelp.class end=last ;
    /* Check if the observation is the 1st, 15th, 6th, or the last observation */
    if _n_ in (1, 15, 6) or last then do;
        /* Use PUT with column positioning correctly */
        put @15 name $10. @30 sex $1. @40 age 3. @50 height 5.1 @60 weight 5.1 @70 ;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;In the above code i want get variable names also&amp;nbsp; in log window with data when using _NULL_ dataset&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 11:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952518#M372256</guid>
      <dc:creator>pavank</dc:creator>
      <dc:date>2024-12-04T11:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: varibale names when using _null_  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952519#M372257</link>
      <description>&lt;P&gt;I don't understand. Variable names in the log window? Doesn't the log show you the code you execute, which includes the PUT statement with the variable names?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 11:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952519#M372257</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-12-04T11:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: varibale names when using _null_  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952520#M372258</link>
      <description>&lt;P&gt;Use the equal sign to also display the variable names:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put name= sex= age= height= weight=;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2024 11:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952520#M372258</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-04T11:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: varibale names when using _null_  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952522#M372260</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I want to display top&amp;nbsp; as below&lt;/P&gt;
&lt;P&gt;Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sex&amp;nbsp; &amp;nbsp; &amp;nbsp;age&amp;nbsp; height&amp;nbsp; &amp;nbsp; &amp;nbsp; weight&lt;/P&gt;
&lt;P&gt;Alfred&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&amp;nbsp; &amp;nbsp; &amp;nbsp; 14&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;69&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;112.5&amp;nbsp;&lt;BR /&gt;James&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;57.3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;83 6&lt;BR /&gt;Philip&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M&amp;nbsp; &amp;nbsp; &amp;nbsp; 16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;72&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;150&amp;nbsp;&lt;/P&gt;
&lt;P&gt;William&amp;nbsp; &amp;nbsp; &amp;nbsp;M&amp;nbsp; &amp;nbsp; &amp;nbsp; 15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;66.5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;112 19&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 11:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952522#M372260</guid>
      <dc:creator>pavank</dc:creator>
      <dc:date>2024-12-04T11:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: varibale names when using _null_  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952523#M372261</link>
      <description>&lt;P&gt;Use PROC PRINT and you get it in the Output window.&lt;/P&gt;
&lt;P&gt;If you want to see the names in the log, use this as the first statement in the step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _n_ = 1 then put "name sex age height weight";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(adjust positions as needed)&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 11:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952523#M372261</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-12-04T11:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: varibale names when using _null_  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952530#M372265</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/390518"&gt;@pavank&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please listen to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;and use PROC PRINT, this is sooooo much easier than writing DATA _NULL_ code to do what you want. And PROC PRINT has many other useful option as well, that you may need on other problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To steal again from Kurt, see &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 7&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;H3 id="toc-hId-1947910763" class="western"&gt;Maxim 7&lt;/H3&gt;
&lt;H4 id="toc-hId-1893769739" class="maxim-western"&gt;There is a procedure for it.&lt;BR /&gt;(The exception proves the rule)&lt;/H4&gt;
&lt;P class="remark-western"&gt;Learn to use prefabricated procedures for solving your tasks. 5 lines of proc means may equal 20 lines (or more) of data step logic.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 04 Dec 2024 13:25:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952530#M372265</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-12-04T13:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: varibale names when using _null_  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952539#M372267</link>
      <description>&lt;P&gt;Assuming you want to PUT the names (not retrieve them from some unspecified place) just use a PUT statement with quoted strings.&amp;nbsp; You probably only want to write the names once say on the first observation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    set sashelp.class end=last ;
    if _n_=1 then put @15 'Name' @(30-2) 'Sex' @40 'Age' @50 'Height' @60 'Weight' ;
    /* Check if the observation is the 1st, 15th, 6th, or the last observation */
    if _n_ in (1, 15, 6) or last then do;
        /* Use PUT with column positioning correctly */
        put @15 name $10. @30 sex $1. @40 age 3. @50 height 5.1 @60 weight 5.1 @70 ;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;              Name         Sex         Age      Height    Weight
              Alfred         M          14        69.0     112.5
              James          M          12        57.3      83.0
              Philip         M          16        72.0     150.0
              William        M          15        66.5     112.0
&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2024 15:24:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952539#M372267</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-04T15:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: varibale names when using _null_  dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952604#M372286</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your solution&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2024 06:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/varibale-names-when-using-null-dataset/m-p/952604#M372286</guid>
      <dc:creator>pavank</dc:creator>
      <dc:date>2024-12-05T06:47:16Z</dc:date>
    </item>
  </channel>
</rss>

