Date: Thu, 17 Jan 2008 11:34:52 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: How to check what variable of dataset has a particular value
On Thu, 17 Jan 2008 08:11:50 -0800, Pardee, Roy <pardee.r@GHC.ORG> wrote:
>Did you try Ron's suggestion?
Ron was inspecting variable "labels" (metadata), not variable values.
>I think that does what you want--it
>should return info from every member (dataset, view etc.) in libname
>'LIBRARY'. You'll no doubt want to change that library to match the
>libname you're interested in (and don't forget to specify that in
>all-caps).
>
>HTH,
>
>-Roy
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>SAS_learner
>Sent: Wednesday, January 16, 2008 6:50 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: How to check what variable of dataset has a particular
>value
>
>Hello Ronald,
>
>I think I was not clear enough in my question Okay if I have if for
>example in a Library where there more than say 30 to 50 datasets and in
>one of dataset there is observation value "INFORMED CONSENT DATE" and I
>do not know which dataset has that . Is there a way to find out which
>Variable has a value equal to "INFORMED CONSENT DATE"
>
> Please let me know if I am clear enough otherwise I can write back with
>an example in that way I might be clear enough
>
>thanks for your help
>
>
>
>On Jan 15, 2008 4:13 PM, Fehd, Ronald J. (CDC/CCHIS/NCPHI)
><rjf2@cdc.gov>
>wrote:
>
>> > From: SAS_learner
>> > Subject: How to check what variable of dataset has a particular
>> > value
>> >
>> > hello _all_,
>> >
>> > I am using following .SAS program to Check if there a Variable exits
>
>> > in the whole Library
>> >
>> > Proc Contents Varnum data = Raw._all_
>> > Out = co(Keep = memname Name ) Noprint ;
>> > run;
>> > ***Check if a variable with a Required name exits in whole
>> > Library**; Proc Sql Noprint ;
>> > create table test1 as
>> > Select memname, name
>> > from co
>> > where upcase(name) like ('%CDTC%') ; Quit ;
>> >
>> > In the Above example I am checking if there is a variable CDTC in
>> > the Name, but If sometimes I need to check the value of a variable
>> > for example I was looking If what variable in the library has a
>> > value "INFORMED CONSENT DATE " then I can use corresponding Date
>> > as INFCDTC.
>> >
>> > I need check different domains to see where it is collected instead
>
>> > I want a SAS program to tell me what variables has value close to
>> > Query String in this case "INFORMED CONSENT DATE".
>> >
>> > Is it Possible to check in Whole Library.
>>
>> you want Dictionary.Columns which
>>
>> PROC SQL; select MemName, Name, Type, Length, Label
>> from Dictionary.Columns
>> where LibName eq 'LIBRARY'
>> and ( upcase(name) like ('%CDTC%')
>> or upcase(Label) contains ('INFORMED')
>> or upcase(Label) contains ('CONSENT')
>> or upcase(Label) contains ('DATE')
>> );
>> quit;
>>
>> You could use this
>> or upcase(Label) contains ('INFORMED CONSENT DATE')
>>
>> but the above will give you more hits to ponder
>>
>> Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
>>
|