Thank you for the warm welcome! I tried this code: data work.mlv4;
set work.mlv3;
length Purpcall_newcat1 $60
Purpcall_newcat2
Purpcall_newcat3 $100
Purpcall_newcat4 $80;
if ...
...
run; However, the SAS log says: 12 data work.mlv2;
13 set work.ml;
14 length Purpcall_newcat1 $60
15 Purpcall_newcat2
16 Purpcall_newcat3 $100
WARNING: Length of character variable Purpcall_newcat1 has already been set.
Use the LENGTH statement as the very first statement in the DATA STEP to declare the
length of a character variable.
17 Purpcall_newcat4 $80;
WARNING: Length of character variable Purpcall_newcat2 has already been set.
Use the LENGTH statement as the very first statement in the DATA STEP to declare the
length of a character variable.
WARNING: Length of character variable Purpcall_newcat3 has already been set.
Use the LENGTH statement as the very first statement in the DATA STEP to declare the
length of a character variable.
18 if (Purpcall_categ = "CDRSS inquiries"
19 or Purpcall_categ = "CDRSS access and contact tracing guidance"
20 or Purpcall_categ = "CDRSS access issues; case reporting"
21 or Purpcall_categ = "CDRSS data disprepancy issues; quarantine guidance"
22 or Purpcall_categ = "LTCF asking to reduce submissions of line lists and testing"
23 or Purpcall_categ = "Reporting death, CDRSS data entry issues"
24 or Purpcall_categ = "asking to speak to LTC staff regarding line list")
25
26 then Purpcall_newcat1 = "CDRSS Inquiry";
27 run; I made sure to do it in my very first data step since in the first one, my added variables (Purpcall_newcat1,2, & 3) were not present in work.ml. So I am unsure why it is saying the length of character variable has been set already. Could it be something I can put in my proc import statement? I looked it up and saw that putting "guessingrows=x" can be a fix to avoid truncation but everywhere I put it I get an error. Here is my import statement without the guessingrows statement: PROC IMPORT OUT= WORK.ml
DATAFILE= "C:\Users\Frank\Desktop\NJDOH Projects\ECC Data\EC
C_July8.xls"
DBMS=EXCEL REPLACE;
RANGE="ECC_July8$";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN; Do you know where I can put it in here to not give me an error if this could fix it? Edit: So I have sort have fixed the issue a little. Turns out that for some reason I had the variables "Purpcall_newcat1, 2, & 3 in my original Excel spreadsheet. I must have added it in and forgotten to take it out. After taking them out, the code that you gave me worked and gave me no errors. It also says that the lengths are all defined as 600 (I ended up making the number 600 because of this issue I am having now). The new issue I am having now is that in Purpcall_newcat1 "Covid Related Guidance/Inquries" is now getting cut off after the "q" in inquiries (which was the first issue I described in my post) However, in Purpcall_newcat2, "Covid Related Guidance/Inquires" is not being cut off at all, despite having the same length as "Purpcall_newcat1". Any idea why that is? Edit 2: I am so sorry, your solution did work. I completely forgot again that I had purposefully assigned the value "Covid Related Guidance/Inq" so if someone went to look at the code, they wouldn't be confused with the value being cut off. Thank you so much for your help! I would have never thought of doing your solution!
... View more