• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 775
  • Last Modified:

SAS EG - New Column

hi
I would like to create a new column  with defult value. may i know how to do this?
for ex. I wan a new column "State" and I want to assign "NSW" to all the records.
thanks
0
premkripalani
Asked:
premkripalani
  • 3
  • 3
1 Solution
 
Aloysius LowCommented:
are you writing a code to do so? are you using any UI e.g. Enterprise Guide?

for code:
data [libname].[table name];
  set [libname].[table name];
  length [field] $[max length].;  <-- for numeric fields it'll be length [field] [length in bits min 3 max 8].;
  [field] = "[value]";  <-- no quotation marks for numeric values
run;

using the UI is another story, depending on the UI.
0
 
premkripalaniAuthor Commented:
sorry, I am using enterprise guide
thanks
0
 
Aloysius LowCommented:
you could still try to run the code - that is universal across versions of enterprise guide. but for EG4.2, i'm not too sure how different it is from EG4.1 which i am currently using.

for EG4.1, you'll need to open the table and unprotect the data (turn off read-only), then select a column and right click. you should be able to select insert a column. on the resulting dialog box, you can specify the column name, description, type, length, format, informat, and default value (including using an expression to derive the value) for the new column. again, i'm not sure how this differs in EG4.2
0
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

 
premkripalaniAuthor Commented:
i am able to create a new column but i can't find "default" value option in the properties, where it is exactly please.
0
 
Aloysius LowCommented:
when adding a new column do you see an expression box?

are you able to screen shot the dialog box to add a new column? i can try to help from there
0
 
premkripalaniAuthor Commented:
great,
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now