|
SAS-L,
I have a data set with a series of variables
with these names:
firstvar .... ID NAME CODE MUGVAR
..............
C1G1_CI C1G1_FOM C1G1_SFL C1G1_SOE
C1G2_CI C1G2_FOM C1G2_SFL C1G2_SOE
C1G3_CI C1G3_FOM C1G3_SFL C1G3_SOE
C2G4_CI C2G4_FOM C2G4_SFL C2G4_SOE
C2G5_CI C2G5_FOM C2G5_SFL
C2G5_SOE C2G6_CI C2G6_FOM C2G6_SFL
C2G6_SOE C3G7_CI C3G7_FOM C3G7_SFL
C3G7_SOE C3G8_CI C3G8_FOM
C3G8_SFL C3G8_SOE C3G9_CI C3G9_FOM
C3G9_SFL C3G9_SOE C4G10_CI C4G10_FM
C4G10SFL C4G10_SE
C4G11_CI C4G11_FM C4G11SFL C4G11_SE
C4G12_CI C4G12_FM C4G12SFL C4G12_SE
C4G13_CI C4G13_FM
C4G13SFL C4G13_SE C5G14_CI C5G14_FM
C5G14SFL C5G14_SE ....lastvar
The following select clause in a PROC SQl :
select distinct
compress(substr(name,(index(name,'G')),3),'_')
into: name_g separated by ' '
from dictionary.columns
where libname='ESRD'
and memname="%upcase(&dsnold)"
and type='num'
and (substr(name,1,1)='C'
and (substr(name,3,1)='G')) ;
generates this resulting macro variable:
SYMBOLGEN: Macro variable NAME_G
resolves to G1 G10 G11 G12 G13 G14 G2 G3
G4 G5 G6 G7 G8 G9
What I want for the macro variable NAME_G
is:
G1 G2 G3 G4 G5 G6 G7 G8 G9 G10 G11 G12
G13 G14
Can I change the way "distinct" causes the
observations to be sorted? Or is there a prefix
or suffix that could be added to each element
of NAME_G so that "distinct" would cause
sorting in the desired way? Any other ideas
appreciated.
This is only my second application of
dictionary tables and stuffing macro variables
using PROC SQL. It is so useful and cool I
would hate to have to give up on this and do it
another way.
Thank you in advance for your help.
Rodney
Rodney J. Presley, Ph.D.
PRO-West
10700 Meridian Av. N., suite 100
Seattle, WA 98133
206-364-9700 voice
206-440-2644 fax
wapro.rpresley@sdps.org
|