BookmarkSubscribeRSS Feed
Tsievu100
Fluorite | Level 6

Hello,

 

I am actually trying to visualize my data using a map graph. Therefore, i decided to use proc gmap.

 

I have an excel file which contains different variables. One of them is the state id of polish voivodeships (in map Poland2 the variable is contained in the range between 1 to 16). For that reason I changed in the excel file the variable's name for wojid - so that it was the same in both input data set (the one from excel) and in the map dataset. I also changed the lenght of the variable (in the dataset imported from excel it was 8 and in the map it was 5) so using the data step i changed it in both for numeric 5. I sorted both map dataset by wojid and exported it by using 'out' statement and my excel dataset. I am not sure what steps should i take further. I have a variable dochg, which represents income. I would like to visualize the average income (var dochg) for every single voivedoship (var wojid) but unfortunately i am getting all the time an error. I am doing following procedures:

 

Sorting the dataset maps poland2 by var wojid and exporting it to dataset = polska.

 

proc sort data=maps.poland2 out=polska;
by wojid;
run;                                

 

Changing the length of var wojid to 5.

 

data gospy;
set work.gospodarstwa;
length wojid 5.;
run;

 

Sorting the new dataset by var wojid

 

proc sort data=gospy;
by wojid;
run;

 

And then i would like to visualize the results by using below statement:

 

proc gmap data=gospy map=polska all;
id wojid;
choro dochg;
run;
quit;

 

And i get a following error :

 

34         proc gmap data=gospy map=polska;
35         id wojid;
36         choro dochg;
37         run;

ERROR: Input data set missing X variable.
ERROR: Input data set missing Y variable.
38         quit;

 

I should add that i would like to firstly create a dataset which contains the average of the variable dochg classed by the variable wojid, therefore i use:

 

proc means data=idvar sum;
class wojid;
var dochg;
output out=sredniak;
run;

 

Can someone please help me? I am struggling with this case for quite a long time without any success. If you need any further info please let me know. I should add that i am quite new to data analysis and therefore I am not so fluent with cases in which i face problems. I am attaching the excel file with the dataset.

 

Thanks a lot in advance for any queries/answers!

 

Tsievu100

 

2 REPLIES 2
ballardw
Super User

The Poland2 data set is basically to provide name information. The actual map coordinate data set is Poland. There is a variable in the Poland data set ID that matches the Powiat value in the ID variable in the Poland2 set

Tsievu100
Fluorite | Level 6

Thank you very much,

 

can you as well tell me what can i do, if i want to use the proc means procedure in order to get the means of a variable dedicated to particular classes (options class in proc means) so that means were the only options in the dataset? Please see the pictures below. I use these codes:

 

proc means data=idvar mean;
class wojid;
var dochg;
output out=sredniak;
run;

proc print data=sredniak;
run;

 

And I would like the dataset 'sredniak' to contain only the data which is shown using proc means. Unfortunately, if i use proc print then i get as well std, min, max and as well I get the general statistics for the whole dataset, not only for particular classes.

 

Thanks,

 

Tsievu100

 


Proc means.PNGProc print.PNG

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
  • 2 replies
  • 1327 views
  • 0 likes
  • 2 in conversation