Hi to all,
i have a problem with this:
The dataset initial is below:
ASSET TIPE | DOB | VEHICLE_AGE | VEHICLE COST | REG_DATE | SNAPSHOT_DATE | TERM |
NEW | 10/09/81 | 0 | 15000 | 01/03/14 | 01/04/14 | 12 |
USED | 15/08/86 | 6 | 10000 | 01/09/13 | 01/04/14 | 12 |
NEW | 26/11/92 | 0 | 20000 | 01/03/14 | 01/04/14 | 24 |
USED | 17/02/95 | 18 | 5000 | 01/09/12 | 01/04/14 | 36 |
CAN YOU TELL ME WHAT IS A SAS DATASTEP WHICH CAN BE USED TO FIND THE AGE (IN WHOLE YEARS) FOR THE CUSTOMERS OF THE NEW VEHICLES AS AT SNAPSHOT_DATE.?
AND WHAT IS A SAS DATASTEP CAN BE USED TO FIND THE CONTRACT END DATE OF THE VEHICLE WITH TERM =36, ASSUMING THE VEHICLE WAS PURCHASED ON THE SNAPSHOT_DATE?
I THINK THAT THE CORRECT ANSWER IS:
SELECT
ADD_MONTHS(SNAPSHOTDATE,36)
FROM'INITIAL DATA'
WHERE TERM=36
Hi to all,
i have a problem with this:
The dataset initial is below:
ASSET TIPE | DOB | VEHICLE_AGE | VEHICLE COST | REG_DATE | SNAPSHOT_DATE | TERM |
NEW | 10/09/81 | 0 | 15000 | 01/03/14 | 01/04/14 | 12 |
USED | 15/08/86 | 6 | 10000 | 01/09/13 | 01/04/14 | 12 |
NEW | 26/11/92 | 0 | 20000 | 01/03/14 | 01/04/14 | 24 |
USED | 17/02/95 | 18 | 5000 | 01/09/12 | 01/04/14 | 36 |
CAN YOU TELL ME WHAT IS THE MEAN FOT THE DOWNPAYMENT VARIABLE BELOW?
DOWNPAYMENT
10
.
2
0
I dont see the DOWNPAYMENT variable in the initial data set?
you can calculate the mean of DOWNPAYMENT like this
data have;
input DOWNPAYMENT;
datalines;
10
.
2
0
;
proc means data=have mean;
var DOWNPAYMENT;
run;
Hi,
Avoid writing in capitals it is not plesant to read. To answer your questions:
To find age, there are a number of methods, but
yrdiff(dob,eventdt,'age')
Is probably simlest (assuming you have 9.3 or after version)
To find the record with term=36 then a:
where term=36;
Line can be added to a datastep.
For the code presented, no, it is not correct, there are several mistakes in it, no proc sql; / quit; being present is one, a function I do not know as 2, from shouldn't need quotes.
Hi to all,
i have a problem with this:
The dataset initial is below:
ASSET TIPE | DOB | VEHICLE_AGE | VEHICLE COST | REG_DATE | SNAPSHOT_DATE | TERM |
NEW | 10/09/81 | 0 | 15000 | 01/03/14 | 01/04/14 | 12 |
USED | 15/08/86 | 6 | 10000 | 01/09/13 | 01/04/14 | 12 |
NEW | 26/11/92 | 0 | 20000 | 01/03/14 | 01/04/14 | 24 |
USED | 17/02/95 | 18 | 5000 | 01/09/12 | 01/04/14 | 36 |
CAN YOU TELL ME WHAT IS A SAS DATASTEP WHICH CAN BE USED TO FIND THE AGE (IN WHOLE YEARS) FOR THE CUSTOMERS OF THE NEW VEHICLES AS AT SNAPSHOT_DATE.?
AND WHAT IS A SAS DATASTEP CAN BE USED TO FIND THE CONTRACT END DATE OF THE VEHICLE WITH TERM =36, ASSUMING THE VEHICLE WAS PURCHASED ON THE SNAPSHOT_DATE?
I THINK THAT THE CORRECT ANSWER IS:
SELECT
ADD_MONTHS(SNAPSHOTDATE,36)
FROM'INITIAL DATA'
WHERE TERM=36
CAN YOU HELP ME PLEASE? I HAVE AN IMPORTANT EXAM BUT I DON'T KNOW WHAT IS THE CORRECT ANSWER FOR THIS QUESTION.
CAN YOU TELL ME WHAT IS A SAS DATASTEP WHICH CAN BE USED TO FIND THE AGE (IN WHOLE YEARS) FOR THE CUSTOMERS OF THE NEW VEHICLES AS AT SNAPSHOT_DATE.?
AND WHAT IS A SAS DATASTEP CAN BE USED TO FIND THE CONTRACT END DATE OF THE VEHICLE WITH TERM =36, ASSUMING THE VEHICLE WAS PURCHASED ON THE SNAPSHOT_DATE?
I THINK THAT THE CORRECT ANSWER IS:
SELECT
ADD_MONTHS(SNAPSHOTDATE,36)
FROM'INITIAL DATA'
WHERE TERM=36
CAN YOU HELP ME PLEASE? I HAVE AN IMPORTANT EXAM BUT I DON'T KNOW WHAT IS THE CORRECT ANSWER FOR THIS QUESTION.
Since Select as you are showing is not VALID in a DATASTEP, why do you propose that as part of a solution you are requesting for DATASTEP?
If your variables are SAS date valued variables with a format such as mmddyy10 then the functions YRDIF or Intck can return "age",
and the function INTNX is used to increment values:
data want;
set have;
age = intck('year',dob,snapshotdate); /* close by you need to look up more details on your own*/
contractenddate= intnx('month',snapshotdate,36);
format contractendate mmddyy10.
run;
PLEASE DO NOT SHOUT BY USING ALL CAPITAL LETTERS. AND REPEATING THE EXACT SAME POST IS NOT RESPONDING TO QUESTIONS THAT ARE DESIGNED TO HELP GET A RESPONSE TO YOUR QUESTION.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.