BookmarkSubscribeRSS Feed
jerry898969
Pyrite | Level 9

Hello,

I have an sas file that is being created in a C# application.  There is a notes field that users can populate and put carriage returns in.

When I try and run the below insert statement in sas it gives me the below error on the first set of "||"

proc sql ;

Insert into Notes (id, text)

values(1,'test' || '0d0a'x || '' || '0d0a'x || '')

;

quit ;

ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant,

              a missing value, ), +, ',', -, MISSING, NULL, USER.

ERROR 200-322: The s00-322: The symbol is not recognized and will be ignored.s not recognized and will be ignored.

If I insert a row into this table with an empty text field then update the field with the same text it works fine.  How can I get around this and still get the desired results?

Thank you

3 REPLIES 3
Tom
Super User Tom
Super User

Did you try having the C program concat the values and then emit the string as Hex so that you could generate.

values(1,'746573740D0A200D0A'x)

art297
Opal | Level 21

Did you try using a set statement rather than a values statement?  e.g.:

data notes;

  informat text $30.;

  format text $30.;

  input id text &;

  cards;

15 this is a test

;

proc sql ;

  Insert into Notes (id, text)

    set id=1,

      text='test'||'xx'||'0d0a'x||'yy'||'0d0a'x||''

  ;

quit;

jerry898969
Pyrite | Level 9

Hi Art,


Thank you for your reply.  I was working on a different project so I apologize for my late reply.

I have it working now by doing an insert that only populated the primary key and then did an update to populate the text. 

When I get back on the project I plan on looking into your suggestion.  I will post back once I do.

Thank you for your help.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 6064 views
  • 0 likes
  • 3 in conversation