<?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: SAS GETVARC in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43148#M8827</link>
    <description>I think so...&lt;BR /&gt;
&lt;BR /&gt;
What i'm doing is reading a dataset using the open through the DDV and then trying to output to a text file using a dummy dataset (file out). The reason I need to output to a file is what I am trying to do is read in the contents of the dataset and output it in a special syntax.. kind of like xml. with the tags as the colum names and the content as the contents of the tags.</description>
    <pubDate>Mon, 01 Sep 2008 14:16:08 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-09-01T14:16:08Z</dc:date>
    <item>
      <title>SAS GETVARC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43146#M8825</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Just wondering if anyone has a clue about what is wrong with a bit of my program. I am getting an error on the log - &lt;BR /&gt;
SYMBOLGEN:  Macro variable FIELDVALUE resolves to&lt;BR /&gt;
SYMBOLGEN:  Macro variable DSID resolves to 1&lt;BR /&gt;
SYMBOLGEN:  Macro variable VAR_LIST resolves to FUND_CODE FUND_ID LONG_NAME&lt;BR /&gt;
SYMBOLGEN:  Macro variable DSID resolves to 1&lt;BR /&gt;
WARNING: Argument 2 to function GETVARC referenced by the %SYSFUNC or %QSYSFUNC macro function&lt;BR /&gt;
         is out of range.&lt;BR /&gt;
&lt;BR /&gt;
What I'm trying to do is read and output content of a dataset to an external file.&lt;BR /&gt;
&lt;BR /&gt;
%macro json;&lt;BR /&gt;
%let dsid=%sysfunc(open(work.fundinfo));&lt;BR /&gt;
	%if &amp;amp;dsid ne 0 %then	&lt;BR /&gt;
		%do;&lt;BR /&gt;
				%do %while(%sysfunc(fetch(&amp;amp;dsid)) = 0);&lt;BR /&gt;
					%let number_of_vars = %sysfunc(countw(&amp;amp;var_list));&lt;BR /&gt;
					put fund_code;&lt;BR /&gt;
					%let fieldvalue= %sysfunc(getvarc(&amp;amp;dsid, 1));&lt;BR /&gt;
					put "&amp;amp;fieldvalue";&lt;BR /&gt;
				%end;&lt;BR /&gt;
				%let rc=%sysfunc(close(&amp;amp;dsid));&lt;BR /&gt;
		%end; /* End do - if */&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
The problem seems  to be happening to the first of the three column of the dataset. If I change the getvarc to look for column 2, it works fine. Column 1 is a number type and columns 2 &amp;amp; 3 are text - it shouldnt make a difference.&lt;BR /&gt;
&lt;BR /&gt;
Can anyone help? Thanks.</description>
      <pubDate>Mon, 01 Sep 2008 11:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43146#M8825</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-09-01T11:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS GETVARC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43147#M8826</link>
      <description>Obviously it does make a difference with SAS handling CHARACTER and NUMERIC variables differently.  Did a search at the SAS support website &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  and this DOC gem reference comes up.&lt;BR /&gt;
&lt;BR /&gt;
Do you really need to have a mixture of macro and DATA step for your application processing?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS 9.2 LANGUAGE REFERENCE&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/sclref/59578/HTML/default/a000144252.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sclref/59578/HTML/default/a000144252.htm&lt;/A&gt;</description>
      <pubDate>Mon, 01 Sep 2008 14:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43147#M8826</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-09-01T14:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS GETVARC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43148#M8827</link>
      <description>I think so...&lt;BR /&gt;
&lt;BR /&gt;
What i'm doing is reading a dataset using the open through the DDV and then trying to output to a text file using a dummy dataset (file out). The reason I need to output to a file is what I am trying to do is read in the contents of the dataset and output it in a special syntax.. kind of like xml. with the tags as the colum names and the content as the contents of the tags.</description>
      <pubDate>Mon, 01 Sep 2008 14:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43148#M8827</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-09-01T14:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS GETVARC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43149#M8828</link>
      <description>I think you would also achieve that using a simple Data step, with arrays, FILE and PUT statements, and VNAME (or VLABEL) function to retrieve the current variable name or label.&lt;BR /&gt;
In fact, this is how I create XML files, if it is for one-shot use. If not, I'd rather create a custom markup ODS destination using the Template procedure.&lt;BR /&gt;
&lt;BR /&gt;
Olivier</description>
      <pubDate>Mon, 01 Sep 2008 14:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43149#M8828</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2008-09-01T14:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS GETVARC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43150#M8829</link>
      <description>Have a look at the SAS support website &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; and search for ODS MARKUP TAGSET XML for your keywords.  Or, as Olivier mentioned, a simple DATA step process to an external file would be more efficient.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi27/p134-27.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi27/p134-27.pdf&lt;/A&gt;</description>
      <pubDate>Mon, 01 Sep 2008 14:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43150#M8829</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-09-01T14:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS GETVARC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43151#M8830</link>
      <description>Hi:&lt;BR /&gt;
  That is pretty much a description of what the SAS XML Libname Engine does. For example:&lt;BR /&gt;
[pre]&lt;BR /&gt;
libname simple xml 'c:\temp\dataout.xml';&lt;BR /&gt;
        &lt;BR /&gt;
data simple.classout;&lt;BR /&gt;
  set sashelp.class;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
gives you data like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
   &amp;lt;CLASSOUT&amp;gt;&lt;BR /&gt;
      &amp;lt;Name&amp;gt; Alfred &amp;lt;/Name&amp;gt;&lt;BR /&gt;
      &amp;lt;Sex&amp;gt; M &amp;lt;/Sex&amp;gt;&lt;BR /&gt;
      &amp;lt;Age&amp;gt; 14 &amp;lt;/Age&amp;gt;&lt;BR /&gt;
      &amp;lt;Height&amp;gt; 69 &amp;lt;/Height&amp;gt;&lt;BR /&gt;
      &amp;lt;Weight&amp;gt; 112.5 &amp;lt;/Weight&amp;gt;&lt;BR /&gt;
   &amp;lt;/CLASSOUT&amp;gt;&lt;BR /&gt;
   &amp;lt;CLASSOUT&amp;gt;&lt;BR /&gt;
      &amp;lt;Name&amp;gt; Alice &amp;lt;/Name&amp;gt;&lt;BR /&gt;
      &amp;lt;Sex&amp;gt; F &amp;lt;/Sex&amp;gt;&lt;BR /&gt;
      &amp;lt;Age&amp;gt; 13 &amp;lt;/Age&amp;gt;&lt;BR /&gt;
      &amp;lt;Height&amp;gt; 56.5 &amp;lt;/Height&amp;gt;&lt;BR /&gt;
      &amp;lt;Weight&amp;gt; 84 &amp;lt;/Weight&amp;gt;&lt;BR /&gt;
   &amp;lt;/CLASSOUT&amp;gt;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
...complete with XML processing instruction and root tag at the top of the file. Otherwise, I agree with Scott and Olivier-- macro is probably overkill for this until you have the program working for ONE dataset -- then you can make it work for more than one by adding macro coding. But the bulk of the work can be done by either SXLE or ODS MARKUP. At this point, however, unless you want the default XML for an XML report, I'd recommend sticking with the Libname Engine.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 02 Sep 2008 14:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-GETVARC/m-p/43151#M8830</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-09-02T14:21:54Z</dc:date>
    </item>
  </channel>
</rss>

