我是新手,我已經發布了這個問題。但我想我沒有解釋得很好。如何在我的結果中使用SAS獲得遺漏頻率
我在SAS裏有一個DATA。 某些單元格爲空[無],並且在SAS輸出窗口中,單元格中有一個DOT。 當我運行結果,在表的末尾,它添加MISSING FREQUENCY = 7或任何數字...
如何使SAS忽略缺失頻率並只使用有結果的那個。 .. 請參閱我的屏幕截圖,代碼和我的CSV:OUTPUT DATA
RESULT WITH the MISSING frequency at the bottom
/* Generated Code (IMPORT) */
/* Source File:2012_16_ChathamPed.csv */
/* Source Path: /home/cwacta0/my_courses/Week2/ACCIDENTS */
PROC IMPORT
DATAFILE='/home/cwacta0/my_courses/Week2/ACCIDENTS/2012_16_ChathamPed.csv'
OUT=imported REPLACE;
GETNAMES=YES;
GUESSINGROWS=32767;
RUN;
proc contents data=work.imported;
run;
libname mydata"/courses/d1406ae5ba27fe300" access=readonly;
run;
/* sorting data by location*/
PROC SORT ;
by LocationOfimpact;
LABEL Route="STREET NAME" Fatalities="FATALITIES" Injuries="INJURIES"
SeriousInjuries="SERIOUS INJURIES" LocationOfimpact="LOCATION OF IMPACT"
MannerOfCollision="MANNER OF COLLISION"
U1Factors="PRIMARY CAUSES OF ACCIDENT"
U1TrafficControl="TRAFFIC CONTROL SIGNS AT THE LOCATION"
U2Factors="SECONDARY CAUSES OF ACCIDENT"
U2TrafficControl="OTHER TRAFFIC CONTROL SIGNS AT THE LOCATION"
Light="TYPE OF LIGHTHING AT THE TIME OF THE ACCIDENT"
DriverAge1="AGE OF THE DRIVER" DriverAge2="AGE OF THE CYCLIST";
/* Here I was unable to extract the drivers age 25 or less and te drivers who disregarded stop sign. here is how I coded it;
IF DriverAge1 LE 25;
IF U1Factors="Failed to Yield" OR U1Factors= "Disregard Stop Sign";
Run;
Also, I want to remove the Missing DATA under the results. But in the data, those are just a blank cell. How do I tell SAS to disregard a blank cell and not add it to the result?
Here is what I did and it does not work...
if U1Factors="BLANK" Then U1Factors=".";
Please help me figre this out...Tks
IF U1Factors="." Then call missing(U1Factors)*/;
Data want;
set imported;
IF DriverAge1 LE 25 And U1Factors in ("Failed to Yield", "Wrong Side of Road",
"Inattentive");
IF Light in ("DarkLighted", "DarkNot Lighted", "Dawn");
run;
proc freq ;
tables /*Route Fatalities Injuries SeriousInjuries LocationOfimpact MannerOfCollision*/
U1Factors /*U1TrafficControl U2Factors U2TrafficControl*/
light DriverAge1 DriverAge2;
RUN;
您還沒有顯示你想要的結果。我會推薦帖子。 – Reeza
爲什麼在PROC SORT和DATA步驟之間有IF語句? – Tom