BookmarkSubscribeRSS Feed
riya_lopinti
Fluorite | Level 6

Hi,

 

I'm completly new to SAS .kindly bear with me !

so here is my question..how can i predict a value of a particular variable based on another variable value.

for instace : i have a dataset with variables risk, age and it has values as follows:

12 57

24 67

13 58

56 86

so on..

 

So now i need to predict the value of the risk if age increases by 10 years  or i can say

'By how much does the risk increase if age increases by ten years?'

 

any help is highly appreciated.Thank you 

 

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I believe you really need to speak with your statistician or who requested this as there are many models and methodolgies which could be implemented for this from a simple, take base number and increment it by value * 100 + (age / 100 * 10), i.e. the percentage difference between age and age + 10 multiplied by original added on, to far more complex routines and models.  Or it could be risk doesn't increase, hence previous value remains.  Only the person who wants this can really tell you.

SuryaKiran
Meteorite | Level 14

It depends on how do you want to interpolate your values. For me looking at the sample data linear interpolation would work. There are different approached in SAS to handle like this and my favorite one is using PROC EXPAND. 

Eg: I want to interpolate risk for 78(age) then I would do like this:

infile datalines dlm=" " dsd;
input risk age;
datalines;
12 57
24 67
. 78
13 58
56 86
;
run;
proc sort data=have;
by age risk;
run;
proc expand data=have out=want;
convert risk=Predicting/method=join;
id age;
run;

Also check this http://support.sas.com/kb/24/560.html

Thanks,
Suryakiran
riya_lopinti
Fluorite | Level 6

Hi , 

 

Thank you for your valuable input .However ,i'm using SAS university edition and i dont think i can use the mentioned procedure[Expand]..So is there an alternate Proc i can use to fix this issue. I just completed  SAS training and using University edition for practise purpose.So please help me on this .Thank you so much !! 

 

Regards

Riya.

SuryaKiran
Meteorite | Level 14

Your missing values can  be filled by taking the average from previous and next values, 

data want;
retain _risk;
do i=1 by 1 until(not missing(risk_));
	set have(rename=risk=risk_);
	end;
do j=1 to i;
set have;
If not missing(risk) then _risk=risk;
if missing(risk) then risk=(_risk+risk_)/2;
Output;
end;
keep age risk;
run;

 

 

 

Thanks,
Suryakiran
riya_lopinti
Fluorite | Level 6

Hi, 

Thanks a lot for helping me .But still i'm not clear on this .So please bear with me ..

 My dataset dont have any missing values as shown below :

It has 2 variables risk, age .

12 57

24 67

13 58

56 86

28 59

51 76

Now i need to predict the value of the risk if age increases by 10 years  or simply

'By how much does the risk increase if age increases by ten years?'

 

Does your answer still holds good for this question.If so .please briefly explain sir.  if not please provide your suggestions .

Thank you so much !

 

Regards

Riya

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 969 views
  • 2 likes
  • 3 in conversation