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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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