LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 3 Dec 2008 16:14:11 -0500
Reply-To:     SAS_learner <proccontents@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         SAS_learner <proccontents@GMAIL.COM>
Subject:      Re: Finding if Variable Exits or Not
Comments: To: Joe Whitehurst <joewhitehurst@gmail.com>
In-Reply-To:  <129a50e0812031241l7523422do110f4176073e8a27@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

As per this Example

Sample *26003: *Programatically determine if a variable exists in a data set I did something like this

dsid=open('Aed');

Check =varnum(dsid,'Aehind'); Check1 =varnum(dsid,'Aehindo');

If Check ^= 0 and Not Missing(Upcase(Aehind)) ="EPILESPY" Then Cmindc="EPILEPSY"; If Check ^= 0 Then Cmindc=Strip(Upcase(Aehind)); Else If Check1 ^= 0 Then Cmindc=Strip(Upcase(Aehindo)); Else If Cmindc=" ";

But LOG Still have this NOTES Does any body think of avoiding this NOTE:

NOTE: Variable AEHIND is uninitialized. NOTE: Variable AEHINDO is uninitialized.

Thanks for Your Time and Help SL Thanks Joe I am going to explore %Sysfunc as per your Suggestion

On 12/3/08, Joe Whitehurst <joewhitehurst@gmail.com> wrote: > > You can use %sysfunc and 3 SAS Component Language functions to check > for the existence of a variable: > > 1. %SYSFUNC(OPEN(<data-file-name<,mode>>)) > > 2. %SYSFUNC(VARNUM(data-set-id,var-name)) > > 3. %SYSFUNC(CLOSE(data-set-id)) > > See the online docs for guidance on how to use the SAS Component > Language functions mentioned. > > On 12/3/08, SAS_learner <proccontents@gmail.com> wrote: > > I need to find out If a Varible exists in the dataset . So for that I am > > trying to do something like this > > > > *If Not Missing (Aehfrml) then Cmdosfrm = Strip(Upcase(Aehfrml)); * > Else > > Cmdosfrm=" " ; > > > > If %Symexist(Aehfrml) Then Do ; > > If Not Missing(Aehfrml) then Cmdosfrm = Strip(Upcase(Aehfrml)); > > End ; > > Else Cmdosfrm=" " ; > > > > If Not Missing(Aehmddf)and Not Missing (Aehmdd) then Cmdostxt = > > Strip(Aehmddf) ; > > Else > Cmdostxt > > = "" ; > > > > When I do Not Missing () does it checks if a variable exits or does have > any > > values ?? > > > > and Can I use %Symexist inside the datastep if not is there a call > routine > > that I can > > >


Back to: Top of message | Previous page | Main SAS-L page