Re: how to output number of missing values of a text variable on
hi ... how about proc freq ...
data test ;
input a 1 b : $3. c 5 name : $5;
1 a 1 mike
2 . 2 sara
3 a . .
.. a 4 barack
5 a 5 armondo
6 . . .
.. a 7 .
8 a . .
9 . 9 .
value $miss ' ' = 'MISSING' other='NOT MISSING';
proc freq data=test;
table _character_ / missing;
format _character_ $miss.;
to "export on a table" (maybe in Excel) use ODS ...
ods html file='z:\missing.html';
proc freq data=test;
table _character_ / missing;
format _character_ $miss.;
ods html close;
U@Albany School ...Re: how to output number of missing values of a text variable on #3
One more think I do not know about SQL. There are so many.
On 10/22/08, Haris <Karovaldas@gmail.com> wrote:
> Good one, Data _Null_, NMISS function seems to work equally well for
> NUM and CHAR variables and eliminates the need for SUM! Runs faster
> proc sql;
> select catx(' ','nmiss(',name,') as', name)
> into :syntax separated by ", "
> from dictionary.columns
> where Libname = "WORK" AND MemName = "MISSING" ;
> %put NOTE: GENERATED SYNTAX: %bquote(&syntax);
>...Re: how to output number of missing values of a text variable on #2
Using the MISSING function this can be simplified somewhat.
select catx(' ','sum(missing(',name,')) as', name)
into :syntax separated by ", "
where Libname = "WORK" AND MemName = "MISSING" ;
%put NOTE: GENERATED SYNTAX: %bquote(&syntax);
On 10/21/08, Haris <Karovaldas@gmail.com> wrote:
> How about something like this:
> data missing ;
> input a 1 b$ 3 c 5 ;
> cards ;
> 1 a 1
> 2 . 2
> 3 a ...how to output number of missing values of a text variable on a table?
proc means or proc tabulate give quickly number of missing value for
continuous variables on a specific table.
I would like to do the same with a text variable. i would like to
export on a table the number of missing value for my variable.
How about something like this:
data missing ;
input a 1 b$ 3 c 5 ;
1 a 1
2 . 2
3 a .
.. a 4
5 a 5
6 . .
.. a 7
8 a .
9 . 9
proc sql ;
when type='num' then 'sum(' || name || '= . ) as ' || name
when type='char' then 'sum(' || name || "= '' ) as " || name
...Re: How to output number of missing character variables to a file #4
I think that what you are after has been given by me in the other thread of
yours. It does not give the column N which is constant.
On Wed, Feb 3, 2010 at 1:08 AM, Lance Smith <email@example.com> wrote:
> I have a dataset with 50 character variables (SNP1 - SNP50), each of
> which have a certain amount of missing data. I want to create a table
> that will give me the percentage of missing data per variable. Maybe
> something like this:
> VARIABLE N %MISSING
> SNP1 2010 2.6%
&g...Re: Drop variables variables with 100% missing values #4
I'm sure that there are much better examples in the list, but an idea for
nums. If you need it also for chars, you might not add them but use !!
instead. To let it not get too long, you could compress the parts. It is
also not necessary to get it too long, because if there is something other
than " " in the first byte, it is not all blank:
if sex="F" then weight=.;
set test end=eof;
array t(*) _numeric_;
length list $500;
do i=1 to dim(t);
if eof then do;
do i=1 to di...Re: "Missing" macro values, was: Re: Macro Variable Problem #4
Yes, that is correct. I know about the characters BYTE(1) to BYTE(31),
which are being used for macro quoting. That apparently was the easiest way
to implement it in SAS. Otherwise extra special characters to signal the
begin and the end had to be inserted (instead of replaced), and that would
make it much more difficult for the programmers of SAS to realize macro
quoting. Anyway, my question actually is; why are those masking characters
ignored with %EVAL and %SUBSTR? Are they ignored as well with implcit
evaluation of conditions (after %IF)?
Regards - Jim (from home, without SAs a...Re: recoding variables with missing values #4
On Wed, Jun 25, 2008 at 7:34 AM, k <firstname.lastname@example.org> wrote:
> I have a question regarding the recoding of variables with missing
> values. I have a dateset consisting of a two variables both taking the
> value one or zero. I then want to create a third variable that takes
> the value one if both of the original variables have the value one. If
> one or both of the original variables take the value zero then the new
> variable takes the value zero and if one of the original variables
> have a missing value I want the new variables to be a m...Re: count the number of missing values #4
The question that leaps to mind is, does the total number of missing values
really mean anything in andof itself. Seems to me that knowing how many
values are missing per variable seems more along the lines of giving more
useful information. To that end Ron Fehd created a macro and I tweeked his
code to suite my style and speed needs that gives this and much much more
with very little input from the user. In fact my macro not only gives the
freq and percentage of missing values but also of all other distinct values
and can be easily run for character or numeric vars only, or you can do all
...Re: Changing from Text to Value for a bunch of variables #4
Hi other Jim,
I do not know your emailaddress so I have to inform you via the list.
Have a look at http://groups.google.com/groups?hl=en&lr=&ie=ISO-8859-1&q=arecoden&meta=group%3Dcomp.soft-sys.sas
Regards - Jim.
Y. (Jim) Groeneveld MSc
6825 MJ Arnhem
+31/0 26 376 7365; fax 7305
From: jsl [mailto:nospam@NOSPAM.COM]
Sent: Tuesday, September 02, 2003 16:02
Subject: Re: Changing from Text to Value for a bunch of variables...Re: Using a number as a SAS variable name #4
what you provide here, is a tabular output. The question is: why must the
SAS-internal structure look like that without the '_'s? Is that really
necessary, or must only the output look like that?
On Wed, 1 Feb 2006 09:18:11 -0800, Sarav <sarav.sas@GMAIL.COM> wrote:
>Here is some sample data:
>_name_ _2001 _2002 _2003
>SALE 1000 1105 1240
>RSALE 1200 1430 1490
>TRS1Y 10 12 -9
>Now, I need to rename the _2000, _2001 etc, to 2000, 2001, 2003
>etc,...How do I go abt that?
>Thanks for your help an...Re: Set Environment Variable Value from SAS #4
> From: Kevin Myers
> Sent: Thursday, October 08, 2009 7:28 PM
> To: SAS-L@listserv.uga.edu
> Subject: Set Environment Variable Value from SAS
> I need to set the value of an existing system environment
> variable from within SAS under Windows. This value needs to
> be set in the SAS copy of the environment, NOT in the copy of
> the environment for a child process, and not in the
> environment of the process that started SAS. So simply
> executing an operating system SET command won't work. The
> environment that needs to be accessed is the same cop...Re: missing value problem with merged variable #4
I would use an else if; if you have any ones then it is a one, if you =
have all missings then it is a missing, otherwise (all zeros or a =
mixture of zeros and missing), then it is a 0.
if y1=3D1 or y2=3D1 or y3=3D1 or y4=3D1 or y5=3D1 or y6=3D1 then =
else if y1=3D. and y2=3D. and y3=3D. and y4=3D. and y5=3D. and y6=3D. =
----- Original Message -----=20
From: E Joas=20
Sent: Wednesday, July 30, 2008 6:06 AM
Subject: missing value problem with merged variable
I am working wi...Re: How to output number of missing character variables to a file
In the summer of 2004 I already was preparing a macro (MULTFREQ) that would
present the frequencies of many variables in one table. (Because of always
more utgent work that macro hasn't been further developed since.) Yet I want
to include it here as it shows the code to combine frequencies of multiple
variables, with roughly the same range of values (including missings) and
are of the same type. You can simplify it to show just the amounts and
percentages of missing and non-missing values per variable.
A hint: before going on with this example code recode all missings of each