I have a datset of Comcast Telecom Consumer Complaints .I need help . To create a new variable in my existing dataset in new column.
. i am poviding a screenshot of my dataset in photos
Data Dictionary
- Ticket #: Ticket number assigned to each complaint
- Customer Complaint: Description of complaint
- Date: Date of complaint
- Time: Time of complaint
- Received Via: Mode of communication of the complaint
- City: Customer city
- State: Customer state
- Zipcode: Customer zip
- Status: Status of complaint
- Filing on behalf of someone
- Analysis Task
Create a new categorical variable with value as Open and Closed. Open & Pending is to be categorized as Open and Closed & Solved is to be categorized as Closed
i tried many ways but unable to create new variable
1)
data mylib.concast4;
set mylib.concast;
if Status in('Open','Pending') then new_status='Open';
else Status in('Closed ','Solved' ) then new_status='Closed';
run;
error is
error: statement is not valid or out of proper order.
2)
proc sql;
create table mylib.concast4 as
select * from mylib.concast
case
when status in ('open' ,'pending') then new_status='open'
when status in ('closed','solved') then new_status='closed'
else 'others'
end as new_status
from mylib.concast;
quit;
error is ;
ERROR 22-322: Syntax error, expecting one of the following: ;, ',', ANSIMISS, CROSS, EXCEPT, FULL, GROUP, HAVING, INNER, INTERSECT,
JOIN, LEFT, NATURAL, NOMISS, ORDER, OUTER, RIGHT, UNION, WHERE.
ERROR 76-322: Syntax error, statement will be ignored
please help me.