10-18-2019
sivakoya
Obsidian | Level 7
Member since
01-26-2015
- 40 Posts
- 18 Likes Given
- 1 Solutions
- 0 Likes Received
-
Latest posts by sivakoya
Subject Views Posted 1058 10-17-2019 03:34 PM 1964 09-03-2019 04:09 PM 2064 08-28-2019 04:20 PM 1523 02-13-2019 10:13 AM 1538 02-13-2019 08:07 AM 1539 02-13-2019 08:04 AM 1588 02-12-2019 02:03 PM 2970 09-10-2018 01:33 PM 2984 09-10-2018 11:23 AM 2996 09-10-2018 11:03 AM -
Activity Feed for sivakoya
- Posted Loop sum statement in PROC SQL on New SAS User. 10-17-2019 03:34 PM
- Posted Re: FORECAST month end balance using MULTIPLE VARIABLES on SAS Forecasting and Econometrics. 09-03-2019 04:09 PM
- Liked Re: FORECAST month end balance using MULTIPLE VARIABLES for dw_sas. 09-03-2019 04:09 PM
- Posted FORECAST month end balance using MULTIPLE VARIABLES on SAS Forecasting and Econometrics. 08-28-2019 04:20 PM
- Posted Re: Remove matching credit and debit entries in a dataset on New SAS User. 02-13-2019 10:13 AM
- Posted Re: Remove matching credit and debit entries in a dataset on New SAS User. 02-13-2019 08:07 AM
- Posted Re: Remove matching credit and debit entries in a dataset on New SAS User. 02-13-2019 08:04 AM
- Posted Remove matching credit and debit entries in a dataset on New SAS User. 02-12-2019 02:03 PM
- Posted Re: Vintage analysis balance forecast HELP! on SAS Forecasting and Econometrics. 09-10-2018 01:33 PM
- Posted Re: Vintage analysis balance forecast HELP! on SAS Forecasting and Econometrics. 09-10-2018 11:23 AM
- Posted Vintage analysis balance forecast HELP! on SAS Forecasting and Econometrics. 09-10-2018 11:03 AM
- Posted Compare values across multiple variables and flag duplicates on SAS Programming. 07-14-2017 01:13 PM
- Liked Re: Modeling Counts data using PROC genmod + poisson distribution_results interpretation for JacobSimonsen. 06-30-2017 10:02 AM
- Posted Re: Modeling Counts data using PROC genmod + poisson distribution_results interpretation on Statistical Procedures. 06-30-2017 09:27 AM
- Liked Re: Modeling Counts data using PROC genmod + poisson distribution_results interpretation for Rick_SAS. 06-30-2017 09:17 AM
- Posted Re: Modeling Counts data using PROC genmod + poisson distribution_results interpretation on Statistical Procedures. 06-30-2017 08:57 AM
- Liked Re: Modeling Counts data using PROC genmod + poisson distribution_results interpretation for JacobSimonsen. 06-30-2017 08:45 AM
- Posted Re: Modeling Counts data using PROC genmod + poisson distribution_results interpretation on Statistical Procedures. 06-29-2017 02:21 PM
- Posted Modeling Counts data using PROC genmod + poisson distribution_results interpretation on Statistical Procedures. 06-28-2017 11:33 AM
- Posted Re: Testing association between frequency of application grade and time of the day in hourly dataset on Statistical Procedures. 06-27-2017 02:07 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 3 1 3 1
10-17-2019
05:57 PM
2 Likes
Why the non-SAS standard variable names? If they not essential why use them as you have to wrap quotes and an "N" around every one of them. So much extra typing.
... View more
09-03-2019
04:09 PM
Thanks
... View more
02-13-2019
10:40 AM
Hi @sivakoya see if this helps
data have;
input LOAN_NBR INT_AMT_PAID PRIN_AMT_PAID EFF_FROM_DT :date9.;
format EFF_FROM_DT date9.;
cards;
60016100 20.58 -98.50 07Jan2019
60016101 29.72 -80.28 07Jan2019
60016101 15.19 -94.81 28Jan2019
60016102 52.70 -57.35 16Jan2019
60016102 0.00 -110.05 16Jan2019
60016103 121.08 -235.92 04Jan2019
60016122 41.29 -89.06 17Jan2019
60016122 -41.29 89.06 24Jan2019
60016122 57.27 -73.08 29Jan2019
60016212 29.24 -73.85 09Jan2019
60016212 -29.24 73.85 17Jan2019
60016274 142.96 -186.55 11Jan2019
60016274 -142.96 186.55 21Jan2019
60016326 45.99 -96.08 03Jan2019
60016326 -45.99 96.08 08Jan2019
60016326 57.48 -84.59 10Jan2019
60016468 61.45 -113.64 31Dec2018
60016468 -61.45 113.64 31Dec2018
60016501 17.69 -80.70 15Jan2019
60016501 18.76 -79.63 17Jan2019
60016501 -17.69 80.70 17Jan2019
60016701 18.76 -81.24 08Jan2019
60016701 -18.76 81.24 14Jan2019
60016701 26.48 -73.52 22Jan2019
60016701 3.75 -96.25 29Jan2019
60016760 24.25 -102.86 31Dec2018
60016760 5.15 -121.96 07Jan2019
60016760 -5.15 121.96 14Jan2019
60016760 13.24 -113.87 18Jan2019
60016848 32.63 -77.37 21Dec2018
60016848 50.90 -55.10 04Jan2019
60016848 -32.63 77.37 04Jan2019
60016848 18.04 -87.57 18Jan2019
;
data temp;
set have;
n1=abs(INT_AMT_PAID);
n2=abs(PRIN_AMT_PAID);
run;
proc sort data=temp out=_temp;
by loan_nbr n1 n2 ;
run;
data want;
n=1;
do _n_=1 by 1 until(last.loan_nbr);
set _temp;
by loan_nbr;
array t(9999);
if sum(INT_AMT_PAID,lag(INT_AMT_PAID))=0 and sum(PRIN_AMT_PAID,lag(PRIN_AMT_PAID))=0 then do;
t(n)=_n_-1;
n+1;
t(n)=_n_;
end;
end;
do _n_=1 by 1 until(last.loan_nbr);
set _temp;
by loan_nbr;
if _n_ not in t then output;
end;
drop t: n:;
run;
If you want more robust, I can apply hashes , but we do not know how comfortable you are though, so feel free to let us know
... View more
09-10-2018
01:33 PM
sure, thanks!
... View more
07-15-2017
09:29 AM
data have;
infile datalines truncover ;
informat id cell $12. home $12. work $12.;;
input
ID cell $ home $ work $ ;
datalines;
1 (XXX)XXX-XXXX (XXX)XXX-XXXX (YYY)YYY-YYYY
2 (ZZZ)ZZZ-ZZZZ (YYY)YYY-YYYY (ZZZ)ZZZ-ZZZZ
3 (ZZZ)ZZZ-ZZZZ (YYY)YYY-YYYY (YYY)YYY-YYYY
4 (XXX)XXX-XXXX (XXX)XXX-XXXX (XXX)XXX-XXXX
5 (XXX)XXX-XXXX (YYY)YYY-YYYY (ZZZ)ZZZ-ZZZZ
6 (XXX)XXX-XXXX
;
run;
data want;
if _n_=1 then do;
length k $ 100;
declare hash h();
h.definekey('k');
h.definedone();
end;
set have;
length dup_phone all_same $ 1 dup_from temp $ 200;
array x{*} $ cell home work;
do i=1 to dim(x);
k=x{i};
h.replace();
end;
if h.num_items=1 then do;
if cmiss(of x{*})=0 then do;dup_phone='Y';dup_from='All_dup';end;
else do;dup_phone='N';dup_from='All_missing';end;
all_same='Y';
end;
else do;
dup_phone='N';dup_from='No_dup';
do i=1 to dim(x)-1;
do j=i+1 to dim(x);
if not missing(x{i}) and not missing(x{j}) and x{i}=x{j} then do;
yes=1; dup_phone='Y';temp=catx('|',temp,cats(vname(x{i}),'_',vname(x{j})));
end;
end;
end;
if yes then dup_from=temp;
all_same='N';
end;
h.clear();
drop i j k temp yes;
run;
... View more
06-30-2017
01:32 PM
1 Like
If your data consist of a count of events and a count of total trials, then the proper syntax is the following to fit the model which is a logistic model for this binomial response. You can use either LOGISTIC or GENMOD with the same syntax.
proc logistic data=DTI_mod;
class grade DTI;
model bad_accs/total_accs = Grade DTI grade*DTI;
run;
... View more
06-27-2017
02:07 PM
@Ksharp Thank you! These procedures are very appropriate for my analysis.
... View more
05-19-2017
09:28 AM
data have;
input ID value ;
datalines;
1 0
1 0
1 100
1 200
2 0
2 0
2 200
2 0
2 0
3 0
3 100
3 50
3 0
3 200
;
run;
data want;
set have;
by id;
retain want . ;
if first.id then call missing(want);
want=max(want,value);
run;
... View more
02-08-2017
03:11 PM
data have;
input id date yymmdd8. X Y;
format date date9.;
datalines;
1 20160131 1 1
1 20160229 1 2
1 20160331 2 3
1 20160430 3 4
1 20160531 3 5
1 20160630 3 6
2 20160131 1 1
2 20160229 1 2
2 20160331 2 3
2 20160430 2 4
2 20160531 3 5
2 20160630 3 6
3 20160131 1 1
3 20160229 4 2
3 20160331 9 3
3 20160430 9 4
;
run;
data want;
set have;
prev_x = lag(X);
if prev_x > 2 and x > 2 then bad_now = 'N';
else do; if x>2 then bad_now='Y'; else bad_now='N'; end;
run;
data final;
set want;
where bad_now='Y';
run; @ballardwthanks. I have thought of another approach 🙂
... View more
02-07-2017
04:02 PM
@AhmedAl_Attar thanks
... View more
01-26-2017
04:31 AM
Hi,
I am sorry, this is not the correct answer. From the data you presented the output is as @Cynthia_sas has given. I don't see anyway to have dataset labels appearing in the data, unless they are data. Also, chaning the font should not make any difference to the layout of the data. The only time I have seen a zoom make any difference to an outpu is the lines are sometimes not rendered until zoomed in. I was advise that you contact SAS support and get this resolved as it could be anything from a bad SAS setup through to your program, and the information provided here doesn't give the output you describe.
... View more
01-23-2017
11:45 PM
1 Like
The benefit of a SET statement coupled with a BY statement is that you know when you've reached the last record for a by group. And if that last record precedes 31dec2016, you also know to output more records:
data want;
set have;
by account_nbr;
output;
if last.account_nbr and month_end<'31dec2016'd then do until (month_end='31dec2016'd);
month_end=intnx('month',month_end,1,'e');
output;
end;
run;
... View more
01-23-2017
09:55 PM
2 Likes
If it's only about repeating data up to a given month then below should work.
data have;
input month_end date7. acct_nbr x;
format month_end date7.;
datalines;
30sep16 1 100
31oct16 1 50
30nov16 1 25
30dec16 1 10
30sep16 2 100
31oct16 2 0
;
run;
proc sort data=have out=want;
by acct_nbr month_end;
run;
data want;
set want;
by acct_nbr month_end;
output;
if last.acct_nbr then
do while(month_end < '31dec2016'd);
month_end=intnx('month',month_end,1,'e');
output;
end;
run;
... View more
10-04-2016
11:08 PM
Oh. Sure. Try this one .
data have;
input ID attribute1 attribute2 attribute3 BAD $;
datalines;
1 1 0 0 Y
2 1 1 0 N
3 1 0 1 Y
4 0 1 1 N
5 1 1 0 Y
6 1 1 0 N
7 1 0 1 Y
8 1 0 1 N
;
proc iml;
use have nobs nobs;
read all var{attribute1 attribute2 attribute3} into x[c=vnames];
read all var{bad};
close;
xpx=x`*x;
diag=do(1,ncol(xpx)##2,ncol(xpx)+1);
xpx[diag]=.;
print xpx[r=vnames c=vnames l=''];
idx=loc(bad='Y');
if isempty(idx) then print "Bad don't have a Y";
else do;
temp=x[idx,];
per=(temp`*temp)/nobs;
per[diag]=.;
print per[r=vnames c=vnames l='' f=percent8.2];
end;
quit;
... View more