Question

I used the PROC FREQ to count all the specified groups. I am not sure if my code is correct to get in the PROC FREQ. I used the data but the list looks messy. I created to classify all the information into the appropriate name groups but the result of PROC FREQ looks empty but left the title and mentioned Frequency Missing=1. Obviously, I do not do this code right.

Proc Freq without any modification ( but it looks messy):

American Dialect Frequency

? 1
Creole 256
Craole 1
Californian 603
Chicano 302
Chiano 2
Chiaco 1
Midwest 423
Missing
New York City 409
NYC 35
Other 90
Pacific Northwest 128
Pittsburghese 15
Pittsburhese 2
San Francisco 78
Won't say 12

Modify the data... Here is my code:

PROC SORT data=Speechdata; by Dialect;run;
Data Speechdata2;
set= Speechdata;
If substr(Dialet,1,2)='Cr' then Dialect = 'Creole';
    else if substr(Dialect,1,2)='Ca' then Dialect = 'Californian';
    else if substr(Dialect,1,2)='Ch' then Dialect ='Chicano';
    else if substr(Dialect,1,3)='Mid' then Dialect ='Midwest';
    else if substr(Dialect,1,1)='N' then Dialect ='New York City';
    else if substr(Dialect,1,2)='Sa' then Dialect ='Californian';
    else if substr(Dialect,1,2)='Pi' then Dialect ='Pittsburghese';
    else if substr(Dialect,1,2)='Pa' then Dialect ='Pacific Northwest';
    else if substr(Dialect,1,1)='O' then Dialect ='Other';
    else if substr(Dialect,1,1)='NA' then Dialect ='Missing';
    else Dialect ='Missing';
    run;

PROC FREQ data=Speechdata2;
table Dialect/nocum nopercent;
title 'Dialect Frequencies';
run; 
Was it helpful?

Solution

If the code shown is exactly what you submitted, you have a stray equals sign that created a variable named "set" from an uninitialized variable named "Speechdata". The log should have said something like "Created dataset SPEECHDATA2 with 1 observations and 3 variables".

Remove that extract character and you should be fine:

Data Speechdata2;
   set Speechdata;
   /* and so on */

Always check the log for useful info.

OTHER TIPS

You have an equal sign here set= Speechdata

A good rule of thumb will be check your log.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top