Not quite sure what the wrong place is in my array declaration. Log messege is after the code. I created two character arrays and want to pass old variables to newly-defined variables.
Many thanks for help
Code:
DATA SOURCE2;
SET RAW.SOURCE2;
INPUT PE $ FR $ EE $ AD $ VAR1-VAR10 $;
ARRAY NEWVAR[*] $ PUBDATE FRCTQTR ESTTYPE ANALID VAR1-VAR10;
ARRAY OLDVAR[*] $ A B C D E F G H I J K L M N;
DO X = 1 TO DIM(NEWVAR);
NEWVAR[X] = OLDVAR[X];
END;
DROP A B C D E F G H I J K L M N;
RUN;
Log messege
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
You've got a few things going on there.
I'm not sure why you have a SET and INPUT? Input is made to read data in, I don't think you're doing that. Remove that line entirely.
Check the variable types of the old variable from RAW.SOURCE2 -> PROC CONTENTS. Check that all the variables are character already.
It also looks like you might be mixing up your old/new variables but I can't even be sure right now.
You've got a few things going on there.
I'm not sure why you have a SET and INPUT? Input is made to read data in, I don't think you're doing that. Remove that line entirely.
Check the variable types of the old variable from RAW.SOURCE2 -> PROC CONTENTS. Check that all the variables are character already.
It also looks like you might be mixing up your old/new variables but I can't even be sure right now.
Variables A to N are old variables. I like to replace with a set of appropriate new variables by using array. I checked, all the variables, A to N, are character already.
Just a qucik clarification needed. About INPUT statement, would you mean, in general case, it will be used for read data in such as using DATALINE for data creation?
Alphabetic List of Variables and Attributes # Variable Type Len Format Informat Label 1 2 3 4 5 6 7 8 9 10 11 12 13 14
A | Char | 16 | $16. | $16. | A |
B | Char | 16 | $16. | $16. | B |
C | Char | 12 | $12. | $12. | C |
D | Char | 16 | $16. | $16. | D |
E | Char | 10 | $10. | $10. | E |
F | Char | 10 | $10. | $10. | F |
G | Char | 15 | $15. | $15. | G |
H | Char | 15 | $15. | $15. | H |
I | Char | 14 | $14. | $14. | I |
J | Char | 15 | $15. | $15. | J |
K | Char | 15 | $15. | $15. | K |
L | Char | 16 | $16. | $16. | L |
M | Char | 16 | $16. | $16. | M |
N | Char | 15 | $15. | $15. | N |
Hi! I started over my University Edition and removed the INPUT statement as you said. The program works now. Thanks!!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: