f



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;
datalines;
1 a  1 mike
2 . 2  sara
3 a . .
.. a 4 barack
5 a 5 armondo
6 . . .
.. a 7 .
8 a . .
9 . 9 .
;
run;

proc format;
value $miss ' ' = 'MISSING' other='NOT MISSING';
run;

proc freq data=test;
table _character_ / missing;
format _character_ $miss.;
run;



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.;
run;
ods html close;



--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475

> hello
>
> 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.
>
>
0
msz03 (747)
10/21/2008 10:27:23 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
405 Views

Similar Articles

[PageSpeed] 27

Reply:

Similar Artilces:

Re: how to output number of missing values of a text variable on #2
Using the MISSING function this can be simplified somewhat. proc sql; select catx(' ','sum(missing(',name,')) as', name) into :syntax separated by ", " from dictionary.columns where Libname = "WORK" AND MemName = "MISSING" ; %put NOTE: GENERATED SYNTAX: %bquote(&syntax); select &Syntax from Missing; quit; 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 . > . a 4 > 5 a 5 > 6 . . > . a 7 > 8 a . > 9 . 9 > ; > > proc sql ; > select case > when type='num' then 'sum(' || name || '= . ) as ' || name > when type='char' then 'sum(' || name || "= '' ) as " || name > end > into :syntax separated by ", " > from dictionary.columns > where Libname = "WORK" AND MemName = "MISSING" ; > quit ; > > proc sql ; > select &Syntax > from Missing ; > quit ; > Good one, Data _Null_, NMISS function seems to work equally well for NUM and CHAR variables and eliminates the need for SUM! Runs faster too! proc sql; select catx(' ','nmiss(',name,') as', name) into :syntax separated by ...

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 > too! > > 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); > > title 'Missing' ; > select &Syntax > from Missing; > quit; > > On Oct 21, 5:30 pm, iebup...@GMAIL.COM ("./ ADD NAME=Data _null_,") > wrote: > > Using the MISSING function this can be simplified somewhat. > > > > proc sql; > > select catx(' ','sum(missing(',name,')) as', name) > > into :syntax separated by ", " > > from dictionary.columns > > where Libname = "WORK" AND MemName = "MISSING" ; > > %put NOTE: GENERATED SYNTAX: %bquote(&syntax); > > select &Syntax > > from Missing; > > quit; > > > > On 10/21/08, Haris <Karoval...@gmail.com> wrote: > > > > > How about something like this: > > > > > data missing ; > > > input a 1 b...

Re: how to output number of missing values of a text variable on #4
On Wed, 22 Oct 2008 07:44:17 -0700, Haris <Karovaldas@GMAIL.COM> wrote: >Good one, Data _Null_, NMISS function seems to work equally well for >NUM and CHAR variables Not just NMISS. Also N, MAX, and MIN. But that's only in PROC SQL, and only when the functions are applied vertically (that is, with a single argument to be evaluated for each row in the source or each row in the GROUP BY segment). When these functions are used outside PROC SQL, or inside PROC SQL with two or more arguments, they accept only numeric arguments. >and eliminates the need for SUM! Runs faster too! > >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); > > title 'Missing' ; > select &Syntax > from Missing; >quit; > >On Oct 21, 5:30 pm, iebup...@GMAIL.COM ("./ ADD NAME=Data _null_,") >wrote: >> Using the MISSING function this can be simplified somewhat. >> >> proc sql; >> select catx(' ','sum(missing(',name,')) as', name) >> into :syntax separated by ", " >> from dictionary.columns >> where Libname = "WORK" AND MemName = "MISSING" ; >> %put NOTE: GE...

how to output number of missing values of a text variable on a table?
hello 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 ; cards ; 1 a 1 2 . 2 3 a . .. a 4 5 a 5 6 . . .. a 7 8 a . 9 . 9 ; proc sql ; select case when type='num' then 'sum(' || name || '= . ) as ' || name when type='char' then 'sum(' || name || "= '' ) as " || name end into :syntax separated by ", " from dictionary.columns where Libname = "WORK" AND MemName = "MISSING" ; quit ; proc sql ; select &Syntax from Missing ; quit ; On Oct 21, 8:21=A0pm, sofiane <mesbah.sofi...@gmail.com> wrote: > hello > > 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. Proc freq nlevels will allow you to summarise your missing/non-missing values. You can specify a subset of character variables if you are only interested in them. HTH data have; input A B$8-10; cards; 1 X 2 Y 4 F ;run; ods select nlevels; ods output nlevels=3Dnlevels; proc freq data=3Dhave(keep=3D_character_) levels;...

Re: How to output number of missing character variables to a file #2
You should consider using the ODS table OneWayFreqs. It contains all the one way tables for each variable listed in the TABLES statement or with no TABLES statement all variables in the input data. You don't need to combine all those individual tables, etc. etc. better faster easier. I think maybe. On 2/3/10, Jim Groeneveld <jim.1stat@yahoo.com> wrote: > Hi Lance, > > 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 f...

Re: How to output number of missing character variables to a file #5
Something like this may work: proc sql noprint; select 'sum('!!trim(name)!!' is null)/count(*) as '!!trim(name)!! ' format=percent10.2' into :vars separated by ',' from dictionary.columns where memname='XXXX' and libname='YYYY' and name like 'SNP%' and type='char'; create table test as select &vars from YYYY.XXXX; proc transpose name=variable out=pctmiss(rename=(col1=pctmiss));run; Regards, Søren On Tue, 2 Feb 2010 21:08:46 -0800, Lance Smith <medicaltrial@GMAIL.COM> wrote: >Hi > >...

Re: Drop variables variables with 100% missing values
I like PROC FREQ, plus a well chosen value labeling FORMAT, for this. It is easy to code, but if your data is huge it may not be the best choice. data one; input x1 x2 x3 x4:$1. x5 c1 $ c2 $; cards; . 3 5 . . a a .d 2 5 . . a b . 3 4 . .c a c . 5 . . . a d . 1 6 . . a . . 1 5 . . a d . 3 5 . . a e ;;;; run; proc print; run; proc format; value allmiss .-.z=. other=1; value $allmiss ' '=' ' other='1'; run; ods listing close; proc freq; tables _all_; format _character_ $allmiss. _numeric_ allmiss.; ods output OneWayFreqs=OneWayFreqs(keep=table...

Re: Using the value of a SAS variable to select another variable
> From: myself > Subject: Re: Using the value of a SAS variable to select > another variable > > Hello again, > > I am now running into the 'reverse' problem, namely:, keeping > with my previous example, with the fields V1, P1, P2 and P3, > I need my code to do this, depending on the value in the > field V1 > If V1=1 then assign new values (which I calculate) > to the variables P2 and P3, > If V1=2 then assign new value to > P3 and so on. ah, this does not read as systematic > Again, I have more than just 3 fields P's I have 38 >...

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: data test; set sashelp.class; x=.; y=.; if sex="F" then weight=.; run; data _null_; set test end=eof; array t(*) _numeric_; length list $500; do i=1 to dim(t); t(i)+t(i); end; if eof then do; do i=1 to di...

Re: Drop variables variables with 100% missing values #2
If all of your variables are numeric, the following code will work and is relatively simple. Data nomiss; input a b c; char = 'abc'; cards; 1 2 . 2 3 . 4 . . run; Data nomiss; set nomiss; card+1;*create a unique identifier; run; Proc Transpose out = nomiss ( where = (col1 ne .)); by card; run; Proc Transpose out = nomiss (drop = card _name_ ) ; by card; run; proc print; run; Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977 Kunal Kelkar ...

Re: Drop variables variables with 100% missing values #3
You might want to try the function nmiss() with proc sql or the nmiss statistics with proc mean. They are much simpler and may be faster. Hope this helps. LL On Jan 29, 2008 6:25 AM, Kunal Kelkar <mailtokunalkelkar@gmail.com> wrote: > Hi All, > > I have a dataset with many variables with 100% missing values. I want to > drop all the varibales in my SAS dataset with 100% missing values. I want to > automate this process as i am dealing with 300+ variables. > > I am currently using following code but it takes a lot of time. Is there any > other easy way top d...

Re: Drop variables variables with 100% missing values #6
On Tue, 29 Jan 2008 16:55:45 +0530, Kunal Kelkar <mailtokunalkelkar@GMAIL.COM> wrote: >Hi All, > > I have a dataset with many variables with 100% missing values. I want to >drop all the varibales in my SAS dataset with 100% missing values. I want to >automate this process as i am dealing with 300+ variables. > >I am currently using following code but it takes a lot of time. Is there any >other easy way top do it? > >%macro misscheck(dsn=); > >proc contents data=&dsn noprint out=contents; >run; > >proc sql noprint; >select trim(name)...

RE: Are multiple return values really harmful? (Re: determining the number of output arguments)
Greg Ewing wrote: > Jeremy Bowers wrote: > > Generally, returning a tuple is either a sign that your return value > > should be wrapped up in a class, or the function is doing too much. >=20 > While I suspect you may be largely right, I > find myself wondering why this should be so. We > don't seem to have any trouble with multiple inputs > to a function, so why should multiple outputs be > a bad thing? What is the reason for this asymmetry? >=20 > Perhaps it has something to do with positional vs. > keyword arguments. Hm. I'd guess it has mor...

Re: NULL/Missing value in SAS
Jung, I think that what you want to do is DISPLAY missing values as zeroes, rather than actually change their values. To do that, use OPTIONS MISSING='0' (or whatever character you prefer). Hope this helps. Bob Abelson HGSI 240 314 4400 x1374 bob_abelson@hgsi.com jung1975@BELLSOUTH.NET Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> 12/20/2004 11:31 AM Please respond to jung1975 To: SAS-L@LISTSERV.UGA.EDU cc: Subject: NULL/Missing value in SAS Is there anyway I can populate numeric/money fields with Zero if they are nu...

Re: Increase name of variable in sas output
Premalatha, What are you using to create your output. I create one heck of a long variable name 'var123456789123456789123456789' with a length of $1. and using proc print it still showed all of the name. Which leads me to think you are using something like proc report in which case you need to increase your width= value in your define statement. But that is just guessing. Toby Dunn From: Premalatha T <mailprems@YAHOO.COM> Reply-To: Premalatha T <mailprems@YAHOO.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Increase name of variable in sas output Date: Thu, 6 Oct 2005...

Re: counting the number of variables a SAS dataset
Hello Massi... Using the DICTIONARY library you could easily extract whatever = information you need... Examine the following: proc SQL noprint; create table list1 as select * from DICTIONARY.TABLES =20 where LibName eq upcase("YOUR_LIB") and memname =3D "YOUR_SAS_DATASET"; quit; You'll find a bunch of usefull information as well... Have fun... Patrice Bourdages Information System Analyst Industrial Alliance, home and car insurance -----Message d'origine----- De : fuzzy_fi@EXCITE.IT [mailto:fuzzy...

Re: outputting SAS library to a text file
Eric - Look at the CNTLOUT= on proc format (http://xrl.us/tvdc & http://xrl.us/tvde). It writes a dataset with what you want. Use your favorite method to export the dataset. hth Paul Choate DDS Data Extraction (916) 654-2160 -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of elsolo Sent: Wednesday, December 13, 2006 11:41 AM To: SAS-L@LISTSERV.UGA.EDU Subject: outputting SAS library to a text file I have a program that updates a SAS library. It's a big table that references a number to a person ('1010' = 'john' doe'...

Re: count the number of missing values #2
On Sun, 5 Nov 2006 23:58:16 -0800, hba2pd <hba2pd@GMAIL.COM> wrote: >Hello,. > >How can I get the number of missing values in a dataset. I mean, >suppose there are dataset test with variables x1,x2, and x3. I would >like to know how many missing values are there. > >Best regards, In PROC SQL: select nmiss(name) + nmiss(age) + nmiss(sex) + nmiss(height) + nmiss(weight) from sashelp.class; It should handle any combination of numeric and character. If only numerics are involved, a somewhat less verbose alternat...

Re: recoding variables with missing values #4
On Wed, Jun 25, 2008 at 7:34 AM, k <kristoffer.backman@gmail.com> wrote: > Hi. > > 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: recoding variables with missing values #5
Hi Jack, I think If you run this min() function, we wont get the required result extra = min(aa708d,aa666d); e.g. if aa708d=. and aa666d=0 then we get the minimum value '0' since min() omits missing value. But we have to get missing in this case. Suhas "Jack Clark" <JClark@CHPDM.UMBC.EDU> Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> 25-Jun-2008 17:20 Please respond to "Jack Clark" <JClark@CHPDM.UMBC.EDU> To SAS-L@LISTSERV.UGA.EDU cc Subject Re: recoding variables with missing values Will the minimum of the two va...

Re: Pairwise exclusion of missing values in SAS
IMO proc reg or SEM includes the options that serves to keep or not the missing values but the quality step isn't included. this is a step to do before. St�phane. Selon pekkajarvela@EMAIL.COM: > In SPPS regression you can choose how to deal with missing values, i.e. > either to exclude cases listwise, pairwise or replace them with mean. I > haven't been able to find this same option in SAS and I suspect that > SAS uses listwise exclusion by default. Is it possible in SAS > regression to make it exclude cases pairwise? > > Pekka > ...

Re: Setting a sas variable to a VERY high value
Max Integer is system-dependent; to reduce helpdesk calls there is now, v9.*, a system macro variable which contains the max integer: %Put Note: SysMaxLong:&SysMaxLong.; AUTOMATIC SYSMAXLONG 2147483647 PASS-INFO SysScpL =4=XP_PRO PASS-INFO SysVlong =5=9.02.01M0P020508 Ron Fehd the under-the-hood maven CDC Atlanta GA USA RJF2 at cdc dot gov > -----Original Message----- > From: owner-sas-l@listserv.uga.edu > [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of RolandRB > Sent: Friday, December 05, 2008 6:22 AM > To: sas-l@uga.edu > Subject: Q: Setting a sas variable to a VERY high value > > Is there a way of setting a sas numeric variable to effective infinity > without having to think whether your string of nines is high enough > like for a datetime variable? > > ...

Re missing value problem with merged variable
Try blodbeh = max(y1,y2,y3,y4,y5,y6) ; Thanx, Roger S. Clark Address Products Management Branch ...

Re: missing value problem with merged variable
Erik, It seems the logic is doing exactly what you are asking it to. The second line is written so that y1-y6 must all be zero in order to set BLODBEH=0. Your e-mail suggests that maybe this is not what you want. Here is how I interpret what you want. 1. If any of the variables (y1-y6) equals 1, set blodbeh to 1 2. If at least one of the variables (y1-y6) equals 0, and all others are zero or missing, set blodbeh to 0 3. If all of the variables (y1-y6) are missing, set blodbeh to missing (if this logic is incorrect, e-mail the list with corrected logic) This can be done by calculating the sum of y1-y6 and using the value of the sum to determine how to set BLODBEH. Using ELSE statements with mutually exclusive IF conditions will increase the efficiency of your code. The SUMY variable can be dropped when no longer needed, but was left in for the example so you can see it in the PROC PRINT. Hope this helps. data have; input y1-y6; cards; 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 . 0 .. . . . . . 1 0 1 0 1 0 ; run; data need; set have; sumy = sum(of y1-y6); if sumy ge 1 then blodbeh = 1; else if sumy = 0 then blodbeh = 0; else if sumy = . then blodbeh = .; run; proc print data = need; var y1-y6 sumy blodbeh; run; Jack Clark Jack Clark Research Analyst phone: 410-455-6256 fax: 410-455-6850 jclark@hilltop.umbc.edu University of Maryland, Baltimore County Sondheim Hall, 3rd Floor 1000 Hilltop Circle Baltimore, MD 21250 Confidentiality Notice: This e-mail may...

Web resources about - Re: how to output number of missing values of a text variable on - comp.soft-sys.sas

Variable - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Westpac interest rate rise is one of many variable loan rate rises
WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Airbnb upgrades variable pricing tool for hosts
Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Commonwealth Bank raises variable home loan rates
Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

CBA lifts variable home loan rates to offset costs associated with stricter capital requirements
The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

Washington Square Signs Spielbergs, Choi Joins Variable and More
... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

Mozilla moves Firefox to variable release schedule
... schedule process "carefully" and learning "a lot" from it in the past years, Mozilla has announced that Firefox is now moving to a variable ...

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

Staley: 'A lot of different variables...been a hard year'
... 41° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Staley: 'A lot of different variables...been ...

When your environment variables are showing
There are embarrassing moments in life. There is the teacher calling you out as a child in class as you stare out the window wistfully imagining ...

Resources last updated: 3/16/2016 5:40:44 PM