03-24-2020
frupaul
Quartz | Level 8
Member since
03-17-2017
- 95 Posts
- 19 Likes Given
- 1 Solutions
- 3 Likes Received
-
Latest posts by frupaul
Subject Views Posted 787 07-03-2019 06:48 AM 840 12-11-2018 08:04 AM 719 12-03-2018 07:12 AM 1932 11-20-2018 02:12 PM 1995 11-20-2018 12:06 PM 4430 11-04-2018 03:39 PM 867 09-14-2018 12:11 PM 711 09-08-2018 02:18 AM 3274 09-07-2018 07:21 PM 3302 09-07-2018 05:31 PM -
Activity Feed for frupaul
- Posted datelines statement returning incomplete result on SAS Programming. 07-03-2019 06:48 AM
- Liked Re: Difficulty saving user defined format for Tom. 12-11-2018 10:00 AM
- Posted Difficulty saving user defined format on SAS Programming. 12-11-2018 08:04 AM
- Posted SAS DI not recognising field names on SAS Data Management. 12-03-2018 07:12 AM
- Posted Re: Limitation of tranwrd function on SAS Programming. 11-20-2018 02:12 PM
- Liked Re: Limitation of tranwrd function for data_null__. 11-20-2018 02:10 PM
- Posted Limitation of tranwrd function on SAS Programming. 11-20-2018 12:06 PM
- Posted NOTE: The query requires remerging summary statistics back with the original data. on SAS Programming. 11-04-2018 03:39 PM
- Posted Data format conversion on SAS Programming. 09-14-2018 12:11 PM
- Posted Re: I need program for this output on SAS Programming. 09-08-2018 02:18 AM
- Liked Re: transpose and concat for PGStats. 09-08-2018 01:09 AM
- Posted Re: transpose and concat on SAS Programming. 09-07-2018 07:21 PM
- Liked Re: transpose and concat for ballardw. 09-07-2018 07:11 PM
- Posted transpose and concat on SAS Programming. 09-07-2018 05:31 PM
- Posted Re: Duduplication accross rows on SAS Programming. 08-28-2018 04:28 PM
- Liked Re: Duduplication accross rows for FreelanceReinh. 08-22-2018 04:54 PM
- Liked Re: Duduplication accross rows for novinosrin. 08-22-2018 04:54 PM
- Posted Re: Deduplication across rows - extension on SAS Programming. 08-22-2018 11:22 AM
- Liked Re: Deduplication across rows - extension for Jagadishkatam. 08-22-2018 11:20 AM
- Posted Re: Duduplication accross rows on SAS Programming. 08-22-2018 11:04 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 2 08-22-2018 02:10 AM 1 06-18-2017 03:31 AM
02-22-2021
07:27 AM
Hi, First of all, I apologize to up this post but it is probably the closest one that relates to my understanding issues. I feel like I am about to grasp all these concepts but there are still blurry parts concerning definitions. - What's the difference between the "true responders" and the "responders" you mentioned in the definitions? Or is it simply language abuse? - For the % Response, I don't understand what the "proportion of true responders" is. Is it the proportion of responders in each decile calculated with respect to the total number of responders (on the whole data set), or the proportion of responders in each decile with respect to the size of the decile (number of participants in each decile)? To clear things up, say the whole data set contains data about 20,000 individuals, among which 5,000 gave a positive response (say, a donation, associated with a primary event). With a certain predictive model, I get the "best 5%" of my population (which gives me in total 1,000 individuals, i.e. the ones most likely to donate provided that the predictive model is decent), "next best 5%", and so on, which gives me all my deciles. Now imagine that I have a great model and, among these 1,000 individuals, it appears that 760 of them donated. Then, what will my % Response be? Will it be 760/5000 (=15.2%) or rather 760/1000 (=76%)? My guess goes towards the first choice (15.2%), but the definition I gave might not correspond to % Response but rather to % Captured Response. - I don't understand SAS EM's notion of "cumulative". To me, cumulative should add up to 100%, however it is never the case here (except for Cumulative % Captured Response). Therefore, I don't understand the notion of Cumulative % Response. - I don't understand the notion of % Captured Response and of its Cumulative counterpart. What's the difference between % Response and % Captured Response? I think that, with these aspects cleared up, I'll get a better understanding of the notion of lift. Thanks in advance if anybody answers this message, Yann.
... View more
01-30-2020
12:45 PM
As presented at the 2013 Midwest SAS Users Group meeting: http://billqualls.com/mba/index.html
... View more
07-03-2019
07:11 AM
And if you want to avoid skipping over short lines when applying @PeterClemmensen 's solution to an external file, add the truncover option to the infile statement.
... View more
12-11-2018
09:01 AM
1 Like
What did you expect SAS to do in that situation?
When you attach a format to a variable is SAS it just stores the format specification (ie: 'COMMA10.2' ) into the metadata of the dataset. There is no place in Teradata to store that and Teradata wouldn't know what it meant anyway.
If you want to use the formats with the table in SAS then just make sure to re-attach the format with a FORMAT statement.
libname mydb teradata .... ;
proc print mydb.mytable;
format myvar myfmt.;
run;
Otherwise use the format to generate a new character variable withe the decoded value of the variable and store that in Teradata.
data mydb.mytable;
set mysas.mytable;
var1_decode = put(var1,fmt.);
run;
... View more
12-03-2018
08:49 AM
Please do ALWAYS post code in a proper window, either using the "little running man" or the {i} button.
If SAS complains about all variable names with blanks, you may not have set validvarname=any.
... View more
11-20-2018
03:25 PM
1 Like
@FreelanceReinh's solution might look too complicated, but it is the only one that really works. PRXCHANGE would also work well, but compiling a new pattern for every observation would be very expensive.
... View more
11-04-2018
05:30 PM
1 Like
You cam also write this as:
proc sql;
select AGE
,sum((SEX='F') * WEIGHT) as WEIGHT_F
,sum((SEX='M') * WEIGHT) as WEIGHT_M
from SASHELP.CLASS
group by 1;
quit;
... View more
09-14-2018
12:17 PM
1 Like
var = input(put(var, z8.), yymmdd8.);
format var ddmmyys10.;
... View more
09-08-2018
02:18 AM
data Start;
length Name $15;
input Name $;
retain Designee;
if Name = 'Madhu' then do i =1 to 10;
Designee = 'Jr_Associate';
Department = 'QA';
output;
end;
else do i = 1 to 5;
Department = 'PB';
output;
end;
drop i;
cards;
Madhu
sathwik
;
run;
... View more
09-07-2018
08:01 PM
This will create the key variables;
data work.keys;
set work.temp;
by super;
/* this creates maximum of 10 keys, replace with a known max if different*/
array key{10} $ 20;
retain count key: ;
if first.super then do;
call missing (of key(*));
count=1;
end;
else count+1;
key[count]=last;
if last.super;
keep super key: ;
run;
I'll leave the modification of the Proc SQL to an interested reader. Really pretty trivial adding all key variables instead of a single one.
... View more
08-29-2018
06:40 PM
@frupaul I believe you should get hold of Ron cody's Learning SAS by Example: A Programmer's Guide, Second Edition.
It is only safe to be aware @FreelanceReinh's standards are among the best in the world although his humility/modesty might not show that , but the reality for us folks (like you and I) is that we might find the learning curve bit too steep to read Dorfman alike authors. Therefore, my sincere and humble suggestion is to start learning with detailed examples portrayed in Ron cody's , then perhaps look into Art carpenter's book and beyond. HTH & Thank you!
... View more
08-22-2018
05:28 PM
HI @frupaul For some reason, when i tested the solutions with million + records the two step solution previous apparently is the fastest(sighs). I was intrigued to test as @FreelanceReinh diligently pointed out a similar two step solution in the previous thread of yours was much faster and of course he knows i try to pay attention to those finer details to learn more. On my college lab machine, that holds true and in other machines it could be otherwise. FWIW, that was fun testing.
... View more
08-21-2018
10:30 AM
1 Like
Sorry too late, was sleeping.
Assuming i understood your requirement:
data Hierarchy;
infile datalines dlm='' truncover;
length CustID $10 L1 $20 L2 $20 L3 $20 L4 $20 L5 $20 L6 $20 L7 $20 L8 $20;
input CustID $ L1 $ L2 $ L3 $ L4 $ L5 $ L6 $ L7 $ L8 $;
cards;
1 A20 A30 A40 A50 A60 A70 A80
2 A40 A70 A80 A90
3 A70 A80 A90 A100
4 A30 A60 A70
;
run;
data want;
do n=1 by 1 until(l);
set Hierarchy end=l;
array t(*) l8-l1;
array j(100) $ _temporary_;
j(n)=coalescec(of t(*));
end;
l=0;
do until(l);
set Hierarchy end=l;
do _n_=1 to dim(t);
if not missing(t(_n_)) and t(_n_) in j then t(_n_)=cats('XXX',t(_n_));
end;
output;
end;
keep custid l:;
run;
... View more
08-20-2018
06:55 AM
You are mixing up macro and datastep. Macro is nothing more than a find replace system. So lets replace the macro part with the actual values:
data _null_;
If CP ^= CLB then put/ "Failed: Second word of Filename is " CP
". Should be CLB";
else put /"File is fine";
run;
Now you can clearly see why your code does not work. There is no CP variable, nor CLB variable hence nothing=nothing, so the file is fine. If you put quotes around each part then it should work;
%let test_filename=JJJ_CP_LUKAKU;
%let T_word2 = %scan(&test_filename,2,_);
%let Agreed_Word2 = CLB;
data _null_;
If "&T_word2" ^= "&Agreed_Word2" then put/ "Failed: Second word of Filename is &T_word2. Should be &Agreed_Word2.";
else put /"File is fine";
run;
That being said, its really not a good idea in any sense to be doing data processing in macro, as shown above it is just a find/replace system, it does nothing itself just generates some text. A better way of writing the same thing would be:
%let test_filename=JJJ_CP_LUKAKU;
%let agreed_word2=CLB;
data _null_;
if scan("&test_filename.",2,"_") ne "&agreed_word2." then put "Failed: Second word of Filename is &t_word2. Should be &agreed_word2.";
else put "File is fine";
run;
(and do note the dots at the end of each macro variable - always a good idea to do this).
... View more
08-14-2018
10:33 AM
https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0jbl63yy0tktzn1a5hgn7kadtrg.htm
put date monname5.;
Replace the 5 if you want longer.
... View more