12-23-2014 10:34 AM
i have attached an excel file please have a look if you can transpose this for me .
what i want this file to look like
Country Country code Year GDP
Afghanistan --- 1999 ----
Afghanistan 2000 ----
and so on/....
alll the values given are GDP and i want them in one column instead 15.
THanks a lot for helping me .
12-23-2014 11:21 AM
Sorry not tested for the reason I am not sitting in front of my SAS software so my apologies that I can't test or give you a code that you can use as a verbatim. However on a first glance of your data from my cell phone, this is the code that comes to my mind:
Data want(drop= i /*and your year variable list*/);
array arrayname _numeric_ ; /*assuming year variables are numeric- so easily grouped*/
do i=1 to dim(arraynme);
Please do the necessary changes accordingly and you should be able to make it to work for you. If the logic is wrong, my sincere apologies in advance
12-23-2014 11:50 AM
proc sort data=work.'gdp growth'n;
proc transpose data=work.'gdp growth'n out=long1;
by country code;
proc print data=long1;
But your data is strange you have multiple records for each country !!!
If each country have one record the above code will work