BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Criptic
Lapis Lazuli | Level 10

So I want to remove an internal border in my map data set, which I imported from a shape file. It is based on the German zip code and I want to now visualize some insurance zones on top of it. These zones are intermixed with each other, but they never overlap. After I joined my zones to the imported data set everything seems to be fine, everything as a zone and the number of entries doesn't change. Then I use PROC SORT to sort the new joined data set by the insurance zones - again everything seems to be fine. Then in my last step I use PROC GREMOVE and this where things go downhill, the number of entries reduces by about 200.000 and I have no idea why. I am posting the code below with it (hoping my formatting isn't to awful this is my first time posting). Thanks in advance for any help you can give me. &DETAIL is a macro variable that includes the specific insurance zone which the user can specify.

/*This dummy is need because the zones are always in a zip code range*/

DATA PLZ_DUMMY(KEEP=plz);

  x=0;

  DO WHILE(x LE 99999);

    plz=PUT(x,z5.);

    OUTPUT;

    x=x+1;

  END;

  RUN;

  /*Here I join my dummy table with the table that includes the insurance zones*/

  PROC SQL;

  CREATE TABLE GDV_ZONEN AS

  SELECT  a.plz, b.&DETAIL

  FROM PLZ_DUMMY a

  LEFT JOIN kwh_dim.vgv_gdv_tarifzonen b

  ON a.plz BETWEEN b.plz_von and b.plz_bis;

  QUIT;

  /*Here I Left Join my imported data set which is based on the zip code with the data set which includes the zones*/

  PROC SQL;

  CREATE TABLE GDV_ZONEN_KOR AS

  SELECT kb.*, gz.&DETAIL

  FROM KARTEN_BASIS kb

  LEFT JOIN GDV_ZONEN gz

  ON kb.plz = gz.plz;

  QUIT;

  /*Sorting*/

  PROC SORT DATA=GDV_ZONEN_KOR OUT=GDV_ZONEN_SORT;

  BY &DETAIL;

  RUN;

  /*Removing the old ID and setting the zone as the new ID - I think*/

  PROC GREMOVE DATA=GDV_ZONEN_SORT OUT=MAP_DATA;

  ID ID;

  BY &DETAIL;

  RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
Darrell_sas
SAS Employee

I can't tell what you are doing without the data, but the following example seems to be the same thing that you are trying to do:  http://support.sas.com/documentation/cdl/en/graphref/67288/HTML/default/viewer.htm#p0zr4d6x9xv72tn13...

View solution in original post

2 REPLIES 2
Darrell_sas
SAS Employee

I can't tell what you are doing without the data, but the following example seems to be the same thing that you are trying to do:  http://support.sas.com/documentation/cdl/en/graphref/67288/HTML/default/viewer.htm#p0zr4d6x9xv72tn13...

Criptic
Lapis Lazuli | Level 10

Thanks, it seems that when I use MERGE I have no problems with the fragmentation so something most have been of with my JOIN. Thanks for the response.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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