how to use a group of columns in a transpose statement in JSL?
Jun 27, 2014 2:26 PM(1596 views)
Long time SAS programmer but new to JSL. I have a data table and have been able to create a group containing say 20 columns. Running this report next week, It may have 25 columns in the same group and I am looking to find a way to transpose the data table using this variable list of columns. Using JSL, how does one modify the script below to operate off the group name instead of the individual list of columns? The column name is "HB_001 etc."
I did not realize that the columns were in a physical column group (I was thinking of a logical group.)
This appears to have been answered in another post (also Mikeret57's) for this same question. If the columns are in a physical group you can (and by all means should) forgo the tedious approaches below.
*** End EDIT
Here is one way to do it (there are many others) that is hopefully relatively understandable.
Basically you build an expression that contains the columns you want (here, any column with name starting with HB_), then substitute this expression (in place of a placeholder that you've used for this purpose... in this case I called the placeholder "cols") into an expression housing the transpose statement, and evaluate this newly formed expression.