Hi,
If I have a dataset with a CHAR variable named YR that has values in YYYYMM, like 202101 to 202112 and I wanted to modify this dataset so that the YYYY will be 2023, 202301 to 202312. Also, this dataset is indexed.
I used the following code:
proc sql;
update mydata
set substr(YR, 1, 4) = '2023';
quit;
For some reason, I keep getting an error of Expecting =.
Question 1:
What's the proper way to use the substr function in PROC SQL?
Question 2:
What is the correct method for modify this variable in a DATA step without losing the index?
Thanks!