BookmarkSubscribeRSS Feed
ogarduno
Obsidian | Level 7

On the attached file is a assessment that I have to complete but i'm having trouble with questions part 1a and 1b. I'm not to sure how I can approach this problem so I was hoping so one can lead me in the right direction. As of now I have the data imported:

 

/*printing out import*/

proc print data = uchi (obs = 10);
run;

 

proc sort data = uchi;
by person_id;
run;

proc print data = uchi (obs = 100);
run;

 

/*creating numeric dates*/

data case;
set uchi;
informat arrest_date yymmdd10. dispos_date yymmdd10.;
if arrest_date < dispos_date then re_arrest = 1;
run;

 

proc print data = case (obs = 10);
format arrest_date yymmdd10.;
run;

 

3 REPLIES 3
Reeza
Super User

Looks like you're trying to calculate a moving cumulative total. Do you have SAS ETS? If so, try PROC EXPAND. If not, if you search moving statistics you'll find a ton of examples on here or online on how to calculate moving statistics in SAS. 

 

I don't know that uploading your actual assignment is the best idea though....

 


@ogarduno wrote:

On the attached file is a assessment that I have to complete but i'm having trouble with questions part 1a and 1b. I'm not to sure how I can approach this problem so I was hoping so one can lead me in the right direction. As of now I have the data imported:

 

/*printing out import*/

proc print data = uchi (obs = 10);
run;

 

proc sort data = uchi;
by person_id;
run;

proc print data = uchi (obs = 100);
run;

 

/*creating numeric dates*/

data case;
set uchi;
informat arrest_date yymmdd10. dispos_date yymmdd10.;
if arrest_date < dispos_date then re_arrest = 1;
run;

 

proc print data = case (obs = 10);
format arrest_date yymmdd10.;
run;

 


 

ballardw
Super User

"questions part 1a and 1b" are what exactly? If there was an attempt to attach something it apparently did not get attached.

 

If the questions are plain text no need to "attach" anything. Open a code box using the {I} menu icon, copy the text from your document and paste into the box.

Reeza
Super User

@ballardw He attached his full assignment which I suggested he remove, it had personal information.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 443 views
  • 0 likes
  • 3 in conversation