Hi,
To add a new numeric column with default value (null) to an existing dataset, which was imported using proc import, from xlsx file,
i thought this might work:
data alldeals2;
set alldeals;
'% Acquired'n = .;
'Debt Invested (in USD)'n = .;
'Equity Invested (in USD)'n = .;
'Bid Premium'n = .;
'Per-share price'n = .;
'Deal Summary'n = '';
'Therapeutic Category'n = '';
'Last Update'n = .;
run;
When I run the code, variables initialized with numeric null (.) are character types. why ?
I even tried this way:
'% Acquired'n = input('% Acquired'n, COMMA14.2);
but didn't work.
Please help me to make a new & null numeric variable.
Are these variables you are trying to create already in the data set ALLDEALS?
If I remove the SET ALLDEALS; from your code, then try creating one of your variables, what does PROC CONTENTS say? It says the variable is numeric. So the command SET ALLDEALS; must be interfering somehow.
data alldeals2;
'% Acquired'n = .;
run;
proc contents data=alldeals2;
run;
Alphabetic List of Variables and Attributes # Variable Type Len 1 % Acquired Num 8
>
First thing you should do: remove all special chars from all variable names and stick to the normal 26 letters, the underscore and numbers. Anything else must be moved to label, to maintain readable and maintainable code.
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: