BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Steelersgirl
Calcite | Level 5

I am trying to add two new rows into my table. There is no value for either player for a salary column. This is the code I have been trying but it is giving me an error, saying "It is invalid to assign a character expression to a numeric value using the SET clause.

 

PROC sql;
INSERT into work.baseball2
SET name='Babe Ruth', team='New York', league='American', YrMajor='22', CrAtBat='8399', CrHits='2873', CrHome='714', CrRuns='1416', CrRbi='1305', CrBB='621', position='left fielder'
SET name='Roberto Clemente', team='Pittsburgh', league='National', YrMajor='18', CrAtBat='9454', CrHits='3000', CrHome='240', CrRuns='1416', CrRbi='1305', CrBB='621', position='right fielder';
SELECT * from work.baseball2;
quit;

 

1 ACCEPTED SOLUTION

Accepted Solutions
SuryaKiran
Meteorite | Level 14

Hello,

 

The note is very clear here, your are trying to give characters values instead of numeric values.

 

'22' ---> This is character 

22 ---> This is numeric, avoid using the quotes.

 

First check which columns are numeric and which are characters by any of these:

- Describe table 

- proc datasets

- dictionary tables 

 

Thanks,
Suryakiran

View solution in original post

1 REPLY 1
SuryaKiran
Meteorite | Level 14

Hello,

 

The note is very clear here, your are trying to give characters values instead of numeric values.

 

'22' ---> This is character 

22 ---> This is numeric, avoid using the quotes.

 

First check which columns are numeric and which are characters by any of these:

- Describe table 

- proc datasets

- dictionary tables 

 

Thanks,
Suryakiran

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 528 views
  • 0 likes
  • 2 in conversation