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

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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