Simplifying the variable input in SAS -


My data has 90 variables, I want to do the following in the SAS.

Here is my SAS code:

  data testing; Length ID class sex $ 30; Input id $ 1 class $ 4-6 sex $ 8 $ 10; Leaves; 1 3F Y2 sec F Y3 2FN 4 1 MN 5 3FN 6 2MM; Run; Data item 2; Set test; Length 8; Length items $ 8; Tid = _n_; Item = class; Output; Item = sex; Output; Item = hiccup; Output; Keep items; Run; Do I have 9 0 variables to input such data? There should be a very long list. I want to simplify it.   

You can use an ARRAY or Alternatively a PROC TRANSPOSE.

The following is Untested, because you have not given an example of your input dataset.

  data items; ARRAY VARS {*} VAR1-VAR90; Change the set; DO I = LBOUND (Wars) to HBOUUND (Wars); ITEM = VARS {I}; Output; End; Run;  

or

  PROC TRANSPOSE data = test = want out; By ID; Class class - servile; Run;  

In the future it will be best that you can supply your input and desired output.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -