Date: Sun, 4 Sep 2005 13:07:22 -0400
Reply-To: Talbot Michael Katz <topkatz@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Talbot Michael Katz <topkatz@MSN.COM>
Subject: Re: Array Issue
Content-Type: text/plain; charset=ISO-8859-1
Good advice, as usual, but I'm not so sure I'd agree with your preference
for the dictionary tables over proc contents. PROC CONTENTS is fast and
focused only on the data set you're interested in. The dictionary tables
have all the variables for all the data sets in the library. It can take
much longer to search through. And I have had dictionary table searches
bomb because of difficulties with data sets in the library that I wasn't
remotely interested in (it didn't like the fact that there were variables
associated with private, uncatalogued formats that I hadn't created). So,
although it's not as elegant, I've pretty much gone back to PROC CONTENTS.
-- TMK --
"The Macro Klutz"
On Fri, 2 Sep 2005 21:38:57 -0700, David L Cassell <davidlcassell@MSN.COM>
>>I am trying to use the array sentence to convert the 'missing' value to
>This is, in general, a REALLY bad idea. Why are you doing this? It
>will *ruin* later computations, stat analyses, data mining, you name it.
>You won't even be able to get a simple mean anymore without risking
>a wrong answer!
>Unless the problem is that someone managed to build a table with all
>the true zeroes as gaps (so they ends up as missing values), this
>shouldn't be attempted lightly. Even then, this is *dangerous*, since
>you may end up converting some real missings, causing enormous
>headaches later. Please re-think this.
>> I am doing something wrong but I don't get the
>>correct sentece, can you help me, please...???
>>proc contents data = cli out=var_cli noprint;
>>proc sql noprint;
>> select distinct (name) into:var_cli separated by ''
>> from var_cli
>> where type=1;
>> set cli;
>> array diff(*) &var_cli;
>> do i=1 to dim(diff);
>> if diff(i)=0 then diff=0;
> You don't need to go through PROC CONTENTS to do this. You should
>use the SAS data dictionary tables instead.
> You don't even need to do that. You can access all the numeric
>variables in a data set using the _numeric_ keyword, just as you can
>all the character variables using the _character_ keyword.
> But don't do that either. I expect that when you tell SAS-L why you
>are doing this, someone will have a MUCH better idea than converting all
>missing values to zeroes.
>>I solved the Macro variable problem using this sentence, thank you anyway
>>for your helping.
>>%do i=1 %to 6;
>>proc means data = cli_pro(where =(ptype=%trim("&&ptype&i"))) noprint;
>> by CLIENT;
>> VAR status BALANCE_1 BALANCE_2 BALANCE_3;
>> output out=cli_&&ptype&i(drop=_freq_ _type_)
>Oh. Well, I see you didn't listen to my advice on that one either...
>David L. Cassell
>3115 NW Norwood Pl.
>Corvallis OR 97330
>Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ