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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 6304 views
  • 3 likes
  • 3 in conversation