statisticssasproc-sql

SAS proc SQL very weird error recieved after adding a row into data set


so i went ahead and made sure that values in the row im adding are an EXACT match to the original data set. There are only 5 values in the values and 5 columns in the data set HOWEVER i get this error when running SAS

ERROR: VALUES clause 1 attempts to insert more columns than specified after the INSERT table name.

Now here is my code

data productv;
input  Productnum Productnam $ 9-31 ManufacturerNumber  33-36 ProductType $ 43-54 RetailUnitCost 57-63  ;
datalines;
5009    Dream Machine           500       Workstation   $3,200 
4506    Business Machine        450       Workstation   $3,345 
2101    Travel Laptop           400       Laptop        $2,760 
2212    Analog Cell Phone       230       Phone         $35 
4509    Digital Cell Phone      245       Phone         $175 
5003    Office Phone            560       Phone         $145 
1110    Spreadsheet Software    134       Software      $300 
1200    Database Software       113       Software      $799 
3409    Statistical Software    243       Software      $1,899 
2102    Wordprocessor Software  245       Software      $345 
2200    Graphics Software       246       Software      $599 
;


proc sql;
insert into productv (Productnum, Productnam, ManufacturerNumber, ProductType, RetailUnitCost)
VALUES (3480, 'Desktop Computer' , 780 , 'Workstation' , 1,799);
select *
from productv;
quit;

Now why in the world am i getting that error? i checked everything about 50 times over. Very strange. I tried moving things around, changing from character to numerical variables.. no prevail.


Solution

  • 1,7999 is not a valid number for the syntax. The comma you are using is being interpreted as a value separator. SQL thinks the 799 is a value for the non-existant 6th column.

                                                             ----- no
    VALUES (3480, 'Desktop Computer' , 780 , 'Workstation' , 1,799);
    VALUES (3480, 'Desktop Computer' , 780 , 'Workstation' , 1799);
                                                             ---- yes