08-07-2016 01:46 PM - last edited on 08-07-2016 03:08 PM by Reeza
this is my code :
proc sql; create table NZ AS Select Olympicscs1.Probability,Olympicscs1.Account_Name as Client,Olympicscs1.Champ,Olympicscs1.Last_Modified_Date as Modified format MMDDYY8.,Olympicscs1.Deal_Comments,Olympicscs1.Tot_Budget format dollar20., Olympicscs2.Digi_Budget format dollar20. FROM Olympicscs1,Olympicscs2 Where Olympicscs1.Probability=Olympicscs2.Prob_Digi and Olympicscs1.Account_Name=Olympicscs2.Account_Name and Olympicscs1.Probability NE 0 ORDER BY Olympicscs1.Probability; quit; PROC SORT DATA=Nz out=nz2; by descending Probability Client; run;
Proc print data=Nz2 ;
By descending Probability Client;
Var Client Champ Modified Tot_Budget Digi_Budget Deal_Comments;
sum Tot_Budget Digi_Budget;
error: i am geeting a error
WARNING: Data too long for column "Deal_Comments"; truncated to 121 characters to fit.
WARNING: The ID columns were too wide; some were transformed into normal data columns.
What should i do ?
08-08-2016 04:31 AM
Well firstly I would suggest investing in making your code readable. Consistent indentation, capitlisation etc. make code far more readable. Secondly, your code contains unnecessary steps, and typos - the format statment should be format=, the proc sort step is not necessary, nor is the sum in the proc print. I have updated the code below. For your warnings, this is telling you that in you columns DEAL_COMMENTS and CLIENT, there is too much text to print on one line. Personally I would suggest you either reduce the text in those columns, or you look to use proc report, and apply some wrapping - i.e. either split the text into rows yourself or ad breaking codes to the text. You would need to provide some example test data, see link:
To find out how to get test data.
proc sql; create table NZ as select OLYMPICSCS1.PROBABILITY, OLYMPICSCS1.ACCOUNT_NAME as CLIENT, OLYMPICSCS1.CHAMP, OLYMPICSCS1.LAST_MODIFIED_DATE as MODIFIED format=MMDDYY8., OLYMPICSCS1.DEAL_COMMENTS, OLYMPICSCS1.TOT_BUDGET format=dollar20., OLYMPICSCS2.DIGI_BUDGET format=dollar20. sum(OLYMPICSCS1.TOT_BUDGET) as TOT format=dollar20 from OLYMPICSCS1,OLYMPICSCS2 where OLYMPICSCS1.PROBABILITY=OLYMPICSCS2.PROB_DIGI and OLYMPICSCS1.ACCOUNT_NAME=OLYMPICSCS2.ACCOUNT_NAME and OLYMPICSCS1.PROBABILITY ne 0 order by desc OLYMPICSCS1.PROBABILITY, CLIENT; quit; proc print data=nz2; by descending probability client; id probability; var client champ modified tot_budget digi_budget deal_comments; run;