- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am very new to SAS Visual Analytics and I am having problems creating a new Column where I have to use an If Then Else Statement.
The context is: I created a query in design mode with multiple tables. I noticed that we cannot use the Conditional statement in expression clause. How can I create a column with IF Then Else?
These Two Columns exist already
ResolvedTeam ProductResposibleTeam
A X
A Z
B P
C O
A O
C P
D W
What I need is: A new column where I combine two fields under the condition: if resolved by A then return the RroductResponsibleTeam if not return the ResolvedTeam.
What I need as an output is:
NewColumn
X
Z
B
C
O
C
D
Please help with as much details as possible as I am new to the tool. Thanks in advance.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
in SAS VA,
IF ( 'ResolvedTeam'n In ('A') )
RETURN ' ProductResposibleTeam'n
ELSE 'ResolvedTeam'n
Let me know.
Thanks & Regards,
Teja Surapaneni
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please try this:
data want;
set have;
NewColumn=ResolvedTeam;
if ResolvedTeam='A' then NewColumn=ProductResposibleTeam;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here is the error I am getting:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Data set "have" would be based on information provided. I've added syntax to create data set. Please try this:
data have;
input ResolvedTeam $ ProductResposibleTeam $;
datalines;
A X
A Z
B P
C O
A O
C P
D W
;
data want;
set have;
NewColumn=ResolvedTeam;
if ResolvedTeam='A' then NewColumn=ProductResposibleTeam;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The code works but the column is not created. Why?
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
in SAS VA,
IF ( 'ResolvedTeam'n In ('A') )
RETURN ' ProductResposibleTeam'n
ELSE 'ResolvedTeam'n
Let me know.
Thanks & Regards,
Teja Surapaneni
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I really don’t know how it works. There is no error but nothing is happening as an output. Is there anything to do with libraries?
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much.