2021年4月29日星期四

Pivot table with minimum in SAS

I have a table that looks like this :

data work.Hotels;  Length Hotel_Name $9 Class $1 ;  INPUT Hotel_Name $ Class $ Country $ PRICE ;  CARDS ;  Appolpon A Greece 390  Caravel B Greece 468  Christina A Greece 427  Economy B Greece 369  EdenBeach A Greece 499  HanikianBeach C Greece 526  MarinaBeach C Greece 587  Xenia C Greece 534  Agdal B Maroc 447  Almohades B Maroc 482  Atlas A Maroc 511  AtlasArnadi C Maroc 532  Chems C Maroc 450  Dunes A Maroc 569  AlfaMa B Portu 646  AppDo B Portu 652  DELagos C Portu 802  Madeira A Portu 761  Reid's A Portu 1101  ;  run;  

I'm trying to produce a table with the countries as Rows, the Class as columns and for each pair, the name of the Hotel with the minimum price. Something like this :

        A           B           C  Greece  Appolpon    Caravel     Marinabeach  Portu   Madeira     Appdo       Delagos  Maroc   Atlas       Agdal       Chems    

I tried many things like Proc tabulate and i couldn't get any good results.

Thank you

https://stackoverflow.com/questions/67326883/pivot-table-with-minimum-in-sas April 30, 2021 at 08:57AM

没有评论:

发表评论