0
votes

I have the following data. I want to take "veh" variable, starting with its first value, copy it down the row so that output would be something like "veh2" variable. Also, value of "drv" variable should same across its "veh" number.

BEFORE:
veh drv 
-------
1   2   
2   2   
3   1   
1   1   
2   1   
1   2   
3   1   
2   3   
1   1   
.   .   
.   .   
.   .   

AFTER:
veh2 drv2 
-------
1   2   
2   2   
2   2   
1   1   
2   1   
2   1   
3   1   
3   1   
3   1   
.   .   
.   .   
.   . 

But I'm afraid that this will completely destroy the proportional of "drv" and "veh" variable. Is it possible to create rows (like "insert rows" in Excel) in SAS?

If you guys know or have any idea to manipulate the data while keeping the proportional of the variables would be greatly appreciated.

Thanks in advance.

1
I can't follow your question...is what you posted your input data? post what your result data would look like alsoJay Corbett
With a DATA STEP you can certainly create more observations in the output data set...however, I don't understand "copy it down the row" and I can't see the change from your input to output dataJay Corbett

1 Answers

1
votes

I'm not sure what you are looking for with the proportional business, but I think this might be it:

data temp;
   veh = 1; drv = 2; output;
   veh = 2; drv = 2; output;
   veh = 3; drv = 1; output;
   veh = 1; drv = 1; output;
run;

data temp2;
   set temp;

   do i = 1 to veh;
      output;
   end;
run;