f



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: 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$ 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 ;
0
hs
10/23/2008 2:45:40 AM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
627 Views

Similar Articles

[PageSpeed] 34

Reply:

Similar Artilces:

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 ...

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); > >...

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 ...

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 ...

Re: How to output number of missing character variables to a file #4
Lance, 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 <medicaltrial@gmail.com> wrote: > Hi > > 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: 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: "Missing" macro values, was: Re: Macro Variable Problem #4
Hi Toby, 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 <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: 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 Biostatistician Vitatron B.V. Meander 1051 6825 MJ Arnhem The Netherlands +31/0 26 376 7365; fax 7305 Jim.Groeneveld@Vitatron.com www.vitatron.com -----Original Message----- From: jsl [mailto:nospam@NOSPAM.COM] Sent: Tuesday, September 02, 2003 16:02 To: SAS-L@LISTSERV.UGA.EDU 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: >Hi, > >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 = blodbeh=3D1; else if y1=3D. and y2=3D. and y3=3D. and y4=3D. and y5=3D. and y6=3D. = then blodbeh=3D.; else blodbeh=3D0; -Mary ----- Original Message -----=20 From: E Joas=20 To: SAS-L@LISTSERV.UGA.EDU=20 Sent: Wednesday, July 30, 2008 6:06 AM Subject: missing value problem with merged variable Hello everyone, I am working wi...

Re: How to output number of missing character variables to a file
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 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 v...

Web resources about - Re: how to output number of missing values of a text variable on #4 - 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 ...

YouTube v10.32 Tweaks Some Interface Elements And Includes Hints About Virtual Reality Content And Variable ...
Forget Update Wednesday! Monday is the new big day. Not only were we treated to the latest M preview release and the official Marshmallow name, ...

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 ...

Resources last updated: 2/6/2016 6:55:39 AM