<?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 Need to find nth Variable from given dataset in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110000#M10016</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have query regarding Base SAS. i have dataset suppose test and i don't know how many obeservation it has. so i wanted to display nth Variable only (considering n is the any non-negative value&amp;gt;0) also i don't want to use Proc Content. so how could be possible this? Please let me know. i have same issue with database but i got query for sqlserver 2008 which solves my issue. How can i resolve this issue using SAS when there is dataset given.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the SQL query which i used against sqlserver database is the below one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: green; font-family: 'Courier New';"&gt;&lt;STRONG&gt;--If you want to Fetch the nth column name (only name)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @TableName &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;nVarchar&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;100&lt;SPAN style="color: gray;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @NthCol &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;Int&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Select&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @TableName &lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;N'&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;Sysobjects&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @NthCol&lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;SPAN style="color: fuchsia;"&gt;Col_name&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: fuchsia;"&gt;object_id&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;@TableName&lt;SPAN style="color: gray;"&gt;),&lt;/SPAN&gt;@NthCol&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt; ColumnName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: green; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="codecontent"&gt;&lt;DIV class="codesniptitle"&gt;Code Snippet&lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: green; font-family: 'Courier New';"&gt;&lt;STRONG&gt;--If you want to select Record for given Column (with data)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @TableName &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;nVarchar&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;100&lt;SPAN style="color: gray;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @NthCol &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;Int&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Select&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @TableName &lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;N'&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;Sysobjects&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @NthCol&lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @ColName &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; varchar&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;100&lt;SPAN style="color: gray;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @ColName &lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: fuchsia;"&gt;Col_name&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: fuchsia;"&gt;object_id&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;@TableName&lt;SPAN style="color: gray;"&gt;),&lt;/SPAN&gt;@NthCol&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Exec&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;'Select '&lt;/SPAN&gt; &lt;SPAN style="color: gray;"&gt;+&lt;/SPAN&gt; @ColName &lt;SPAN style="color: gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="color: red;"&gt;' From '&lt;/SPAN&gt; &lt;SPAN style="color: gray;"&gt;+&lt;/SPAN&gt; @TableName&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Help. Thanks in Advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Oct 2012 14:53:30 GMT</pubDate>
    <dc:creator>Tushar</dc:creator>
    <dc:date>2012-10-29T14:53:30Z</dc:date>
    <item>
      <title>Need to find nth Variable from given dataset</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110000#M10016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have query regarding Base SAS. i have dataset suppose test and i don't know how many obeservation it has. so i wanted to display nth Variable only (considering n is the any non-negative value&amp;gt;0) also i don't want to use Proc Content. so how could be possible this? Please let me know. i have same issue with database but i got query for sqlserver 2008 which solves my issue. How can i resolve this issue using SAS when there is dataset given.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the SQL query which i used against sqlserver database is the below one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: green; font-family: 'Courier New';"&gt;&lt;STRONG&gt;--If you want to Fetch the nth column name (only name)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @TableName &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;nVarchar&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;100&lt;SPAN style="color: gray;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @NthCol &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;Int&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Select&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @TableName &lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;N'&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;Sysobjects&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @NthCol&lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;SPAN style="color: fuchsia;"&gt;Col_name&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: fuchsia;"&gt;object_id&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;@TableName&lt;SPAN style="color: gray;"&gt;),&lt;/SPAN&gt;@NthCol&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt; ColumnName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: green; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="codecontent"&gt;&lt;DIV class="codesniptitle"&gt;Code Snippet&lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: green; font-family: 'Courier New';"&gt;&lt;STRONG&gt;--If you want to select Record for given Column (with data)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @TableName &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;nVarchar&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;100&lt;SPAN style="color: gray;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @NthCol &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;Int&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Select&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @TableName &lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;N'&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;Sysobjects&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @NthCol&lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Declare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @ColName &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; varchar&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;100&lt;SPAN style="color: gray;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; @ColName &lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: fuchsia;"&gt;Col_name&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: fuchsia;"&gt;object_id&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;@TableName&lt;SPAN style="color: gray;"&gt;),&lt;/SPAN&gt;@NthCol&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;Exec&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;'Select '&lt;/SPAN&gt; &lt;SPAN style="color: gray;"&gt;+&lt;/SPAN&gt; @ColName &lt;SPAN style="color: gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="color: red;"&gt;' From '&lt;/SPAN&gt; &lt;SPAN style="color: gray;"&gt;+&lt;/SPAN&gt; @TableName&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Help. Thanks in Advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2012 14:53:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110000#M10016</guid>
      <dc:creator>Tushar</dc:creator>
      <dc:date>2012-10-29T14:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need to find nth Variable from given dataset</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110001#M10017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Will the following work for you?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let n=5;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;/*&amp;nbsp; get Nth variable name and show it in log*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; select name into :vname&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname=upcase("sashelp") and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname=upcase("class") and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varnum=&amp;amp;n.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put &amp;amp;vname.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&amp;nbsp; output all values for Nth variable*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; select &amp;amp;vname.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.class&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2012 15:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110001#M10017</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-10-29T15:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need to find nth Variable from given dataset</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110002#M10018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you explain what you actually want to do?&amp;nbsp; Why would you be interested in the name of the Nth variable?&amp;nbsp; Many datasets are created without concern for variable (column) order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get all of the variable names from dictionary view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let N=4;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql noprint ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; select name into :colname separated by ' '&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; from dictionary.columns&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; where libname='SASHELP'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and memname='CLASS'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and varnum = &amp;amp;n&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%put Var &amp;amp;n is &amp;amp;colname ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2012 15:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110002#M10018</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-10-29T15:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need to find nth Variable from given dataset</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110003#M10019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For example, n=3:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET P=3;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select name into :name FROM DICTIONARY.COLUMNS&lt;/P&gt;&lt;P&gt;&amp;nbsp; where libname='SASHELP' AND MEMNAME='CLASS' AND VARNUM=&amp;amp;P;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DATA WANT;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class (keep=&amp;amp;name);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2012 15:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110003#M10019</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-10-29T15:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need to find nth Variable from given dataset</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110004#M10020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And if you want the number of observations in a data set the variable NOBS in DICTIONARY.TABLES contains that information. If you want non-missing that's another kettle of fish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2012 15:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110004#M10020</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-10-29T15:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need to find nth Variable from given dataset</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110005#M10021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&amp;nbsp; to a Tom and Hai.kuo..... and very Special thanks to Arthur.. you rock as always... This absolutely worked the way i want. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Oct 2012 19:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-to-find-nth-Variable-from-given-dataset/m-p/110005#M10021</guid>
      <dc:creator>Tushar</dc:creator>
      <dc:date>2012-10-29T19:48:43Z</dc:date>
    </item>
  </channel>
</rss>

