Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a new column in a SAS Data Studio Code Transform step?

Status
Not open for further replies.

TheBugSlayer

Programmer
Sep 22, 2002
887
US
Hello. Don't ask me how I landed on SAS, but it's now on my plate so I am learning...

In my data plan, I am trying need to add a column to an existing dataset. The way I found to do it is by adding a column in a code transform. However, I am struggling to create a variable then assign that variable to the new column. I have looked at a few articles and I feel I am pretty close. As a matter of fact one of the iterations worked but I did not save it before. The error I am getting with this code is

The action was not successful
ERROR: Expecting an arithmetic operator.
ERROR: Syntax error, statement will be ignored.
ERROR: Statement is not valid or it is used out of proper order.
ERROR: Expecting an arithmetic operator. (occurred 16 times)
ERROR: Syntax error, statement will be ignored. (occurred 16 times)
ERROR: Statement is not valid or it is used out of proper order. (occurred 16 times)


Here is my code:

Code:
/* BEGIN data step with the output table data */
data {{_dp_outputTable}} (caslib={{_dp_outputCaslib}} );
/* Set the input set */
set {{_dp_inputTable}} (caslib={{_dp_inputCaslib}} );
length _renamed $50;
if LabName = 'THIS LAB' THEN _renamed = 'THAT LAB' ELSE _renamed = LabName;
"Laboratory_Renamed" = _renamed;
/* END data step run */
run;

What am I doing wrong?

Thank you!

MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA), Training HOTT cert SQL Server 2012 Business Intelligence (SSIS, SSAS).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top