Reputation: 607
I have a table that I am need to create a start point for -the table are changes in NPS. I'm using proc sql to define the value of this.
The "Kategorie" variable in the table is defined as 100 character long.
In my proc sql I define the variable as $100, however because I type the value in, it automatically selects a length of 4 and chops off all the data when I blend it with my existing data set.
So the question is how can I predefine the variable in proc sql so that the length isn't set as 4.
I have a way to get around this but would rather do it correctly and cleanly.
rsubmit ;
proc sql;
create table NPS_START_overall as select
'_NPS' as Kategorie format $100.,
(sum(Promotor)/count(land)-sum(detraktor)/count(land))*100 as RelativeEffect format 8.2
from erk_a;
quit;
endrsubmit;
I am very much still learning so apologise if this is super basic.
Thanks
Upvotes: 2
Views: 32437
Reputation: 5211
The below two methods will help to change the value of the columns to human readable format from exponential expression
Change Format of Numeric Columns:
select put(column_name,NEWBSTw.) AS alias from table_name
Change Format of Character Columns:
select column_name as alias format=$100 from table_name
Upvotes: 0
Reputation: 321
I think that this solves your problem.
select '_NPS' as NPS format=$100. length=100
Upvotes: 7