<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic values less than 60 percentile in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/values-less-than-60-percentile/m-p/718088#M34716</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I am applying proc univariate to find 60th percentile for each variable, i want to find those observations that have at least 3 values less than 60th percentile, how can i modify the dataset sub? appreciate for any help.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc univariate data=mydata ;
   
   VAR v1 v2 v3 v4   ;
    
	output out=output1 pctlpts  = 60
                    pctlpre  =   v1 v2 v3 v4    
          
                    pctlname = _60 ;
     
 run;


 data sub;
   if _n_ eq 1 then set output1;
   set mydata;
   if
      v1=&amp;lt;v1_60 or v2=&amp;lt;v2_60  or v3=&amp;lt;v3_60 or v4=&amp;lt;v4_60 ;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Feb 2021 01:31:46 GMT</pubDate>
    <dc:creator>fatemeh</dc:creator>
    <dc:date>2021-02-10T01:31:46Z</dc:date>
    <item>
      <title>values less than 60 percentile</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/values-less-than-60-percentile/m-p/718088#M34716</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I am applying proc univariate to find 60th percentile for each variable, i want to find those observations that have at least 3 values less than 60th percentile, how can i modify the dataset sub? appreciate for any help.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc univariate data=mydata ;
   
   VAR v1 v2 v3 v4   ;
    
	output out=output1 pctlpts  = 60
                    pctlpre  =   v1 v2 v3 v4    
          
                    pctlname = _60 ;
     
 run;


 data sub;
   if _n_ eq 1 then set output1;
   set mydata;
   if
      v1=&amp;lt;v1_60 or v2=&amp;lt;v2_60  or v3=&amp;lt;v3_60 or v4=&amp;lt;v4_60 ;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Feb 2021 01:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/values-less-than-60-percentile/m-p/718088#M34716</guid>
      <dc:creator>fatemeh</dc:creator>
      <dc:date>2021-02-10T01:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: values less than 60 percentile</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/values-less-than-60-percentile/m-p/718095#M34717</link>
      <description>&lt;P&gt;If V1 through V4 never have missing values then this should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sub;
   if _n_ eq 1 then set output1;
   set mydata;
   if   (v1=&amp;lt;v1_60)+(v2=&amp;lt;v2_60)+(v3=&amp;lt;v3_60)+(v4=&amp;lt;v4_60)&amp;gt;=3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The expression (v1&amp;lt;=v1_60) generates a zero (false) or 1 (true).&amp;nbsp; You want at least 3 trues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if v1..v4 can have missing values, then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sub;
   if _n_ eq 1 then set output1;
   set mydata;
   if (min(v1,v1_60)=v1)+(min(v2,v2_60)=v3)+(min(v3,v3_60)=v3)+(min(v4,v4_60)=v4) &amp;gt;=3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 02:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/values-less-than-60-percentile/m-p/718095#M34717</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-02-10T02:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: values less than 60 percentile</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/values-less-than-60-percentile/m-p/718098#M34718</link>
      <description>&lt;P&gt;Bit of a drag but below will give you exactly three values lower the 60th percentile (SASHELP.CARS used):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars (keep= make invoice enginesize cylinders horsepower);
	set sashelp.cars;
run;

proc univariate data=cars;
	VAR invoice enginesize cylinders horsepower;
	output out=output1 pctlpts  = 60
		pctlpre  =   invoice enginesize cylinders horsepower    

		pctlname = _60;
run;

data sub_invoice (keep=make invoice invoice_60) 
	sub_enginesize  (keep=make enginesize enginesize_60)
	sub_cylinders (keep=make cylinders cylinders_60)
	sub_horsepower (keep=make horsepower horsepower_60);
	if _n_ eq 1 then
		set output1;
	set cars;

	if invoice &amp;lt; invoice_60 then
		output sub_invoice;

	if enginesize &amp;lt; enginesize_60 then
		output sub_enginesize;

	if cylinders &amp;lt; cylinders_60 then
		output sub_cylinders;

	if horsepower &amp;lt; horsepower_60 then
		output  sub_horsepower;
run;

%macro need(in=,out=,byvar=,idvar=);

	proc sql outobs=3 nowarn;
		create table &amp;amp;out. as
			select distinct *
				from &amp;amp;in.
					order by &amp;amp;byvar. desc,&amp;amp;idvar.;
		drop table &amp;amp;in.;
	quit;

	proc sort data=&amp;amp;out.;
		by &amp;amp;idvar.;
	run;

%mend;

%need(in=sub_invoice,out=invoice_out,byvar=invoice,idvar=make);
%need(in=sub_enginesize,out=enginesize_out,byvar=enginesize,idvar=make);
%need(in=sub_cylinders,out=cylinders_out,byvar=cylinders,idvar=make);
%need(in=sub_horsepower,out=horsepower_out,byvar=horsepower,idvar=make);

data final;
	format make $25.;
	set invoice_out enginesize_out cylinders_out horsepower_out;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Feb 2021 02:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/values-less-than-60-percentile/m-p/718098#M34718</guid>
      <dc:creator>qoit</dc:creator>
      <dc:date>2021-02-10T02:34:17Z</dc:date>
    </item>
  </channel>
</rss>

