Recently in the SAS Community Library: SAS' @BethEbersole reveals 4 steps to stop money laundering, solve law-enforcement cases, find missing children and more with SAS Visual Investigator.
Hi I'm trying to calculate outliners within a datset trying: proc sql; SELECT CASE WHEN a.row_num <= ceil(0.25 * b.total_rows) THEN 1 WHEN a.row_num <= ceil(0.5 * b.total_rows) THEN 2 WHEN a.row_num <= ceil(0.75 * b.total_rows) THEN 3 ELSE 4 END AS quartile, AVG(a.value) AS quartile_value FROM (SELECT value, row_num() AS row_num FROM co2_ppp_Av) AS a INNER JOIN (SELECT count(*) AS total_rows FROM co2_ppp_Av) AS b ON 1=1 GROUP BY quartile; quit; My dataset have three col=sector (char), country (char), value (num) ERROR: Function ROW_NUM could not be located. ERROR: Expression using less than or equal (<=) has components that are of different data types. ERROR: Expression using less than or equal (<=) has components that are of different data types. ERROR: Expression using less than or equal (<=) has components that are of different data types. 1451 quit; I can't use OVER or HAVING or such beacuse of my version of my computer,
... View more
I am trying to perform SG Annotation with BY Variables. In this trivial example, I want one plot with a red arrow for the plot of Male data; and one plot for the females with a green arrow, depending on the value of SEX in SASHELP.CLASS
Here's my code that doesn't work (stealing from the example here).
%sganno
data sgannodata;
set sashelp.class(obs=2);
if sex='M' then do;
%sgarrow(x1=51, x2=30, y1=30, y2=30, linecolor="red")
end;
else if sex='F' then do;
%sgarrow(x1=51, x2=30, y1=30, y2=35, linecolor="green")
end;
keep sex;
run;
proc sort data=sashelp.class out=class;
by descending sex ;
run;
proc sgplot data=class sganno=sgannodata;
scatter x=age y=weight;
by descending sex;
run;
Here's the incorrect output (the correct output would be the red arrow on the males and the green arrow on the females, not both arrows on both plots)
... View more
Proc export giving additional quotes to the quoted char values.and if u use data step for that it is giving a space or . To numeric values which is not required . Needs to change nothing.now it is , , but want ,, no space no .for missing numeric value.
... View more
Hi,
I've a sample input data below and the expected output format.
I need to find number of active customers as per the start date of the year and their based on end date, I've to keep the count added for each year.
Example,
Customer A,H,I - Active from 2004, so we have 3 customers active from 2004 and I'm keeping the count added horizontally for each year and by 2009 one customer got dropped. So for 2010 - customer count was 2.
Similarly I've to populate the same for the next row active from 2005 and followed by other rows.
Could you please suggest me the best approach to get this done ?
Thanks in advance for your help.
... View more