BookmarkSubscribeRSS Feed
NazaninSAS
Quartz | Level 8

I tried both.

no difference

novinosrin
Tourmaline | Level 20

try another variant:

 

data want;
set have;
if col1>. then col2='Y';*if col1 is numeric;
/*if col1>' ' then col2='Y';*if col1 is character;*/
run;
NazaninSAS
Quartz | Level 8

no luck!! 😞

novinosrin
Tourmaline | Level 20

I am afraid you really need to share the best sample of what dataset you have for the community to test. More exact or close to being exact will help

novinosrin
Tourmaline | Level 20

@hashman Boss, Sorry for my response in later part of the thread (deliberately). The reason is, I tried to suggest OP all that came to my mind. And for whatever reason OP has responded saying unsuccessful. Even to the previous one just before this. Apparently, so simple thread had extended too long and is still open 😞 

 

data want;
set have;
if col1>. then col2='Y';*if col1 is numeric;
/*if col1>' ' then col2='Y';*if col1 is character;*/
run;
hashman
Ammonite | Level 13

@novinosrin, Yeah, Chief, it's become kind of protracted. Occassinally, OPs have a vague idea what they want and/or express their wishes incompletely or ambiguously ;).

 

Paul D. 

NazaninSAS
Quartz | Level 8
 

col2

1

  

2

25

 

3

  

4

  

6

29

 

7

  

9

  

 

 

col2

1

  

2

25

Y

3

  

4

  

6

29

Y

7

  

9

  

 

I want to go from first data set to the second one. let's call the third column "col3"

 

Thanks,

 

Nazanin

 

 

hashman
Ammonite | Level 13
data two ;
  set one ;
  if not missing (col2) then col3 = "Y" ;
run ;

Paul D.

NazaninSAS
Quartz | Level 8

Thanks a lot Paul,

 

It works. If I want to update on the same dataset, is it possible? also if I have more than one column to update, can I do at the same time?

so basically I want to expand the code to go from table one to table 2.

col1

dis1

dis2

dis3

DIS

VisCode

Vis

InCode

In

1

        

2

3

     

2

 

3

    

6

   

4

 

5

      

5

      

5

 

6

        

7

  

7

     

 

 

col1

dis1

dis2

dis3

DIS

VisCode

Vis

InCode

In

1

        

2

3

  

Y

  

2

Y

3

    

6

Y

  

4

 

5

 

Y

    

5

      

5

Y

6

        

7

  

7

Y

    

 

if I do each update separately, I lose the previous update. How can I do all together?

 

Your help is much appreciated.

best,

 

Nazanin

NazaninSAS
Quartz | Level 8

Hi Paul,

 

This is what I figured it out:

data updateSI2 ;

set SINewCol ;

if not missing (DIS1) or not missing(DIS2) or not missing (DIS3) or not missing (DIS4) or not missing (DIS5) or

not missing (DIS6) or not missing(DIS7) or not missing(DIS8) or not missing(DIS9)then PWD = "Y";

if not missing (AborCode) then Abor="Y";

if not missing ( VisCode) then VisMin="Y" 

;

run ;

 

now I'm working on making it shorter!

 

best regards,

Nazanin

PeterClemmensen
Tourmaline | Level 20

@NazaninSAS, this is not an error. It is a note. You can read more about that particular note in a related thread here.

 

https://communities.sas.com/t5/Base-SAS-Programming/quot-NOTE-49-169-The-meaning-of-an-identifier-af...

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 25 replies
  • 1978 views
  • 2 likes
  • 4 in conversation