BookmarkSubscribeRSS Feed
zxu1
Calcite | Level 5


I like to replace the following column name assignment:

x = {:Name("Lot name"));

by a variable list which contains a list of column names from a table. Say the list is:

var_list = {"Lot name", "Location", "Cost", ...}.

All following are giving me errors:

x = {:Name(var_list[1])};

x = {:Name(char(eval(var_list[1]))};

...

Any good suggestion?

Thanks.

John

6 REPLIES 6
art297
Opal | Level 21

What type of SAS system or proc are you running and how is var_list being created?

zxu1
Calcite | Level 5

Oops! I mean: using JMP/JSL scripting. Not in SAS.

art297
Opal | Level 21

You will probably have more success, then, reposting your question in the JMP forum.

zxu1
Calcite | Level 5

Reeza - thank you for providing the reference link, but not exactly what I need, or at least I cannot find the solution from it yet. Here is what I like to do:

For example, I have a table dt with n columns, X1, X2, ..., Xn. I need to draw distributions for EACH column, X(i), like below (repeat n times):

Distribution(

Continuous Distribution(

  Column( :X1),

  Horizontal Layout( 1 ),

  Vertical( 0 ),

  Normal Quantile Plot( 1 ),

  Capability Analysis( LSL( 4 ), USL( 22 ), Target( 13 ) )

)

);

How can I use a loop to do this? I tried the following, but it is not successful :-(.

ColNameList = dt << Get Column Names(Nominal, String);

for (k=1, k<=n, k++,

Distribution(

Continuous Distribution(

  Column( :ColNameList),

  Horizontal Layout( 1 ),

  Vertical( 0 ),

  Normal Quantile Plot( 1 ),

  Capability Analysis( LSL( 4 ), USL( 22 ), Target( 13 ) )

  )

)

);

zxu1
Calcite | Level 5

It is useful. Thanks.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 4187 views
  • 3 likes
  • 3 in conversation