|
All of the variables are character. Some of them are convertible to numeric
and are so intended. The problem is to identify these.
I think this problem has come up before, so there are probably relevant
items in the archives. Meanwhile I imagine that some of the resident
wizards are working on new code.
But I have a couple of questions.
Is this a one-time (or infrequent) exercise, or will datasets with
different variable name vectors be coming along on a regular basis?
How clean are the data? For example, is it possible that a variable
intended for treatment as a numeric may contain a value like "1O1" (one,
upper case letter "oh", one) instead of "101" (one, zero, one)? In that
case an automated approach may go astray.
On Thu, 9 Oct 2003 14:42:55 -0700, Prasad S Ravi
<prasad.s.ravi@HOUSEHOLD.COM> wrote:
>How about using dictionary.columns to get the char var list and then
>dropping them in a data step.
>
>
>%macro kossack;
>
>proc sql;
> select name into :cvar separated by ' '
> from dictionary.columns
> where libname='WORK' and memname='YOURDATASET' and type='char';
>quit;
>run;
>
>data new;
> set old(drop=&cvar);
>run;
>
>%mend kossack;
>%kossack;
>
>
>Prasad Ravi
>
>
>
>
>
>
> William Kossack
> <kossackw@NJC.ORG> To: SAS-
L@LISTSERV.UGA.EDU
> Sent by: "SAS(r) cc:
> Discussion" Subject: checking data
type before computing stats
> <SAS-L@LISTSERV.UGA.E
> DU>
>
>
> 10/09/2003 02:30 PM
> Please respond to
> William Kossack
>
>
>
>
>
>
>I have a large dataset with 100's of fields.
>
>Due to the wisdom of software (not SAS) all the numeric data is loaded
>into text fields. However, there are freeform text fields in the mix
>with non-numeric data in them. I've actually managed to reduce the
>problem significantly from many hundreds of fields to only 100's of
>fields but I still have 100's to go.
>
>Now they want a report generated on a regular basis giving the basic
>stats mean, range, min, max etc for all of the numeric data. I can
>convert the numeric data in the text field without any problem but first
>I need to be able to filter out the fields containing non-numeric data.
>
>Is there an easy way?
|