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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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