Actuarial Outpost
 
Go Back   Actuarial Outpost > Actuarial Discussion Forum > Software & Technology
FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions

Salary Surveys
Property & Casualty, Life, Health & Pension

Health Actuary Jobs
Insurance & Consulting jobs for Students, Associates & Fellows

Actuarial Recruitment
Visit DW Simpson's website for more info.
www.dwsimpson.com/about

Casualty Jobs
Property & Casualty jobs for Students, Associates & Fellows


Reply
 
Thread Tools Search this Thread Display Modes
  #251  
Old 05-16-2018, 10:20 AM
NormalDan's Avatar
NormalDan NormalDan is offline
Member
CAS
 
Join Date: Dec 2016
Location: NJ
Posts: 6,441
Default

Quote:
Originally Posted by LICENSED TO ILL View Post
Im having trouble finding a way to fill in the blanks by using the previous line. Help.

Code:
MemberID	DATE	UNIT_FACTOR	MEDICAID_FLAG
12345	201801	 1.0000 	Y
12345	201802	 1.0000 	Y
12345	201803	 1.0000 	Y
12345	201804		
12345	201805		
12345	201806	 1.0000 	Y
98765	201711	 1.0250 	N
98765	201712	 1.0250 	N
98765	201713		
98765	201714	 1.0250 	N
98765	201715	 1.0250 	N
98765	201716	 1.0250 	N
Not sure if there's a fancier way, but what I'd do is create two tables, one with the value you're going to match with and the other would contain the blanks.

To get your match values you'd want to create a table of those records which don't have blanks, then sort by descending date and then dedupe on member ID. Then your other table is just a dataset of those who had blanks. Then match across your values from one table to the next to fill in your second table's blanks (being careful to drop extra variables in the first table so as not to overwrite them in the second).

Then recreate your original table by setting together those who originally did not have blanks and those who had blanks but now don't.
Reply With Quote
  #252  
Old 05-16-2018, 10:29 AM
Childish Gambino's Avatar
Childish Gambino Childish Gambino is offline
Member
SOA
 
Join Date: Jul 2014
Posts: 23,647
Default

This is somewhat clunky but should work

Code:
data your_data2;
 set your_data;
 format unit_fill 8.4;
 format mcd_fill $1.;
 if unit_factor = . then unit_factor = unit_fill;
 if medicaid_flag = . then medicaid_flag = mcd_fill; 
 mcd_fill = medicaid_flag;
 unit_fill = unit_factor;
 retain mcd_fill unit_fill;
 drop mcd_fill unit_fill;
run;
__________________
Quote:
Originally Posted by Pseudolus View Post
Trump's biggest weakness is that he utterly lacks the knowledge, experience, interest, attention span, temperament, and common decency to be the marginally effective President of a reasonably-large HOA.
Reply With Quote
  #253  
Old 05-16-2018, 11:06 AM
LICENSED TO ILL's Avatar
LICENSED TO ILL LICENSED TO ILL is offline
Member
 
Join Date: Oct 2005
Posts: 696
Default

Quote:
Originally Posted by Childish Gambino View Post
This is somewhat clunky but should work
I wouldn't say clunky, just easy button. Thanks

This is what I tried but forgot the RETAIN

I hope this works
__________________
Spoiler:
Quote:
Originally Posted by Abelian Grape View Post
Nothing gay about mirin' another bro's gains.
Quote:
Originally Posted by campbell View Post
Want to become aware of my fist?
Quote:
Originally Posted by OddSox View Post
this might be my favorite thread on the AO
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 12:02 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
*PLEASE NOTE: Posts are not checked for accuracy, and do not
represent the views of the Actuarial Outpost or its sponsors.
Page generated in 0.26790 seconds with 10 queries