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
premkripalaniAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
premkripalaniAuthor Commented:
great,
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.