BookmarkSubscribeRSS Feed
randoman24
Calcite | Level 5

 

What are Crime and Arrest trends over Time (eg: by month, day of week, year)?

 

I am trying to make create a chart that shows the trend over time by month day of week and year. 

download.png 

This is where i am at so far. I see the problem being that my Y value has to be a variable and i do not want it to be a variable. I want it to just count from 0 and up. I want it to be a sum. 

 

 

Below is what i am trying to achieve but these are not the variables I use. i just found this picture off the SAS website but it also uses a variable in the Y axis which i don't want to use. I want it to be a sum total of the obseravations

 

images_timex02od.png

 

Essentially i am trying to create a line chart where my X axis is by year and my Y axis is by the total amount of observations of a specific variable (also known as sum). My data has almost 50000 observations and i am trying to show the amount of "arrests" by weekday and month over time. I might be using the wrong chart but i am very confused on why i have to use a variable on the y axis rather than just a sum total.

 

 

 

 

The best way to put it is that i am trying to get the below table into a line plot.

sadf

Table of Year by ArrestYear ArrestArrested Not Arrested Total2001200220032004200520062007200820092010201120122013201420152016Total

11
0.02
16.92
0.08
54
0.11
83.08
0.16
65
0.14
 
 
5
0.01
62.50
0.04
3
0.01
37.50
0.01
8
0.02
 
 
5
0.01
71.43
0.04
2
0.00
28.57
0.01
7
0.01
 
 
4
0.01
57.14
0.03
3
0.01
42.86
0.01
7
0.01
 
 
4
0.01
66.67
0.03
2
0.00
33.33
0.01
6
0.01
 
 
2
0.00
50.00
0.01
2
0.00
50.00
0.01
4
0.01
 
 
5
0.01
50.00
0.04
5
0.01
50.00
0.01
10
0.02
 
 
2021
4.21
27.16
14.76
5420
11.28
72.84
15.78
7441
15.49
 
 
2013
4.19
29.56
14.70
4796
9.98
70.44
13.97
6809
14.17
 
 
1846
3.84
28.45
13.48
4642
9.66
71.55
13.52
6488
13.51
 
 
1769
3.68
28.54
12.92
4430
9.22
71.46
12.90
6199
12.90
 
 
1675
3.49
28.23
12.23
4258
8.86
71.77
12.40
5933
12.35
 
 
1576
3.28
29.42
11.51
3781
7.87
70.58
11.01
5357
11.15
 
 
1431
2.98
30.10
10.45
3323
6.92
69.90
9.68
4754
9.90
 
 
1226
2.55
27.49
8.95
3233
6.73
72.51
9.41
4459
9.28
 
 
104
0.22
21.27
0.76
385
0.80
78.73
1.12
489
1.02
 
 
13697
28.51
34339
71.49
48036
100.00

2 REPLIES 2
Kurt_Bremser
Super User

First of all, post your example data as SAS code, in a data step with datalines. This leaves no question about structure, attributes and contents.

In the current form, your data is not usable.

mkeintz
PROC Star
"why i have to use a variable on the y axis rather than just a sum total."


Use PROC FREQ or PROC SUMMARY to convert your data set into one with one obs per year, having three variables: YEAR, total arrests (say tot_a) and total non-arrests (tot_na). Now you have variables for the Y axis.
--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

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!

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
  • 2 replies
  • 362 views
  • 2 likes
  • 3 in conversation