<?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 how to check if a variable exist into a dataset in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919369#M44414</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This macro function should works but nothing append.&amp;nbsp; What's wrong with that function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro varexist(dsn=,varname=);
/*%local dsid vnum;*/
%let vnum=0;
%let dsid = %sysfunc(open(&amp;amp;dsn));
%if &amp;amp;dsid %then %do;
 %let vnum = %sysfunc(varnum(&amp;amp;dsid,&amp;amp;varname)); 
 %let dsid = %sysfunc(close(&amp;amp;dsid));
 %put &amp;amp;=vnum;
%end;
%mend varexist;
%varexist(dsn=sashelp.class,varname=age);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am not getting the variable position as it is suppose to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 ;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 %LET _CLIENTTASKLABEL='Programme 8';&lt;BR /&gt;4 %LET _CLIENTPROCESSFLOWNAME='Flux de processus';&lt;BR /&gt;5 %LET _CLIENTPROJECTPATH='';&lt;BR /&gt;6 %LET _CLIENTPROJECTPATHHOST='';&lt;BR /&gt;7 %LET _CLIENTPROJECTNAME='';&lt;BR /&gt;8 %LET _SASPROGRAMFILE='';&lt;BR /&gt;9 %LET _SASPROGRAMFILEHOST='';&lt;BR /&gt;10 &lt;BR /&gt;11 ODS _ALL_ CLOSE;&lt;BR /&gt;12 OPTIONS DEV=SVG;&lt;BR /&gt;13 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;14 %macro HTML5AccessibleGraphSupported;&lt;BR /&gt;15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;&lt;BR /&gt;16 %mend;&lt;BR /&gt;17 FILENAME EGHTML TEMP;&lt;BR /&gt;18 ODS HTML5(ID=EGHTML) FILE=EGHTML&lt;BR /&gt;19 OPTIONS(BITMAP_MODE='INLINE')&lt;BR /&gt;20 %HTML5AccessibleGraphSupported&lt;BR /&gt;21 ENCODING='utf-8'&lt;BR /&gt;22 STYLE=HTMLBlue&lt;BR /&gt;23 STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome/x86/SASEnterpriseGuide/8/Styles/HTMLBlue.css")&lt;BR /&gt;24 NOGTITLE&lt;BR /&gt;25 NOGFOOTNOTE&lt;BR /&gt;26 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;27 ;&lt;BR /&gt;28 &lt;BR /&gt;29 %macro varexist(dsn=,varname=);&lt;BR /&gt;30 %local dsid vnum;&lt;BR /&gt;31 %let vnum=0;&lt;BR /&gt;32 %let dsid = %sysfunc(open(&amp;amp;dsn));&lt;BR /&gt;33 %if &amp;amp;dsid %then %do;&lt;BR /&gt;34 %let vnum = %sysfunc(varnum(&amp;amp;dsid,&amp;amp;varname));&lt;BR /&gt;35 %let dsid = %sysfunc(close(&amp;amp;dsid));&lt;BR /&gt;36 %put &amp;amp;=vnum;&lt;BR /&gt;37 %end;&lt;BR /&gt;38 %mend varexist;&lt;BR /&gt;39 %varexist(dsn=sashelp.class,varname=age);&lt;BR /&gt;40 &lt;BR /&gt;41 &lt;BR /&gt;42 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;43 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;44 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;45 %LET _CLIENTPROJECTPATHHOST=;&lt;BR /&gt;46 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;47 %LET _SASPROGRAMFILE=;&lt;BR /&gt;48 %LET _SASPROGRAMFILEHOST=;&lt;BR /&gt;49 &lt;BR /&gt;50 ;*';*";*/;quit;run;&lt;BR /&gt;51 ODS _ALL_ CLOSE;&lt;BR /&gt;52 &lt;BR /&gt;53 &lt;BR /&gt;54 QUIT; RUN;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 21:36:20 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2024-03-07T21:36:20Z</dc:date>
    <item>
      <title>how to check if a variable exist into a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919369#M44414</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This macro function should works but nothing append.&amp;nbsp; What's wrong with that function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro varexist(dsn=,varname=);
/*%local dsid vnum;*/
%let vnum=0;
%let dsid = %sysfunc(open(&amp;amp;dsn));
%if &amp;amp;dsid %then %do;
 %let vnum = %sysfunc(varnum(&amp;amp;dsid,&amp;amp;varname)); 
 %let dsid = %sysfunc(close(&amp;amp;dsid));
 %put &amp;amp;=vnum;
%end;
%mend varexist;
%varexist(dsn=sashelp.class,varname=age);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am not getting the variable position as it is suppose to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 ;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 %LET _CLIENTTASKLABEL='Programme 8';&lt;BR /&gt;4 %LET _CLIENTPROCESSFLOWNAME='Flux de processus';&lt;BR /&gt;5 %LET _CLIENTPROJECTPATH='';&lt;BR /&gt;6 %LET _CLIENTPROJECTPATHHOST='';&lt;BR /&gt;7 %LET _CLIENTPROJECTNAME='';&lt;BR /&gt;8 %LET _SASPROGRAMFILE='';&lt;BR /&gt;9 %LET _SASPROGRAMFILEHOST='';&lt;BR /&gt;10 &lt;BR /&gt;11 ODS _ALL_ CLOSE;&lt;BR /&gt;12 OPTIONS DEV=SVG;&lt;BR /&gt;13 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;14 %macro HTML5AccessibleGraphSupported;&lt;BR /&gt;15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;&lt;BR /&gt;16 %mend;&lt;BR /&gt;17 FILENAME EGHTML TEMP;&lt;BR /&gt;18 ODS HTML5(ID=EGHTML) FILE=EGHTML&lt;BR /&gt;19 OPTIONS(BITMAP_MODE='INLINE')&lt;BR /&gt;20 %HTML5AccessibleGraphSupported&lt;BR /&gt;21 ENCODING='utf-8'&lt;BR /&gt;22 STYLE=HTMLBlue&lt;BR /&gt;23 STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome/x86/SASEnterpriseGuide/8/Styles/HTMLBlue.css")&lt;BR /&gt;24 NOGTITLE&lt;BR /&gt;25 NOGFOOTNOTE&lt;BR /&gt;26 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;27 ;&lt;BR /&gt;28 &lt;BR /&gt;29 %macro varexist(dsn=,varname=);&lt;BR /&gt;30 %local dsid vnum;&lt;BR /&gt;31 %let vnum=0;&lt;BR /&gt;32 %let dsid = %sysfunc(open(&amp;amp;dsn));&lt;BR /&gt;33 %if &amp;amp;dsid %then %do;&lt;BR /&gt;34 %let vnum = %sysfunc(varnum(&amp;amp;dsid,&amp;amp;varname));&lt;BR /&gt;35 %let dsid = %sysfunc(close(&amp;amp;dsid));&lt;BR /&gt;36 %put &amp;amp;=vnum;&lt;BR /&gt;37 %end;&lt;BR /&gt;38 %mend varexist;&lt;BR /&gt;39 %varexist(dsn=sashelp.class,varname=age);&lt;BR /&gt;40 &lt;BR /&gt;41 &lt;BR /&gt;42 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;43 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;44 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;45 %LET _CLIENTPROJECTPATHHOST=;&lt;BR /&gt;46 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;47 %LET _SASPROGRAMFILE=;&lt;BR /&gt;48 %LET _SASPROGRAMFILEHOST=;&lt;BR /&gt;49 &lt;BR /&gt;50 ;*';*";*/;quit;run;&lt;BR /&gt;51 ODS _ALL_ CLOSE;&lt;BR /&gt;52 &lt;BR /&gt;53 &lt;BR /&gt;54 QUIT; RUN;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 21:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919369#M44414</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-03-07T21:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if a variable exist into a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919371#M44415</link>
      <description>&lt;P&gt;Your code works for me:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASKiwi_0-1709847234309.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94470iBEE4F65AB75A6F2C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASKiwi_0-1709847234309.png" alt="SASKiwi_0-1709847234309.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 21:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919371#M44415</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-03-07T21:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if a variable exist into a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919379#M44416</link>
      <description>&lt;P&gt;Set: options mprint mlogic symbolgen;&lt;/P&gt;
&lt;P&gt;before running&amp;nbsp; your macro to see details in the LOG about the execution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code worked for me even using the version from the LOG with the line numbers removed and get the same result as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt; .&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 22:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919379#M44416</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-07T22:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to check if a variable exist into a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919477#M44418</link>
      <description>&lt;P&gt;the issue was solved by the SAS admin.&amp;nbsp; That has nothing to do with the SAS code.&lt;/P&gt;
&lt;P&gt;This inccident can be closed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 15:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-check-if-a-variable-exist-into-a-dataset/m-p/919477#M44418</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-03-08T15:24:03Z</dc:date>
    </item>
  </channel>
</rss>

