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

Yes, the 1 indicated length and could either be specified as the default when you create the informat or, like I did, when you use the informat.

I had to guess at the new informat you introduced, but the following reads the kind of data that I think you are dealing with:

proc format;

  invalue chtono

    Y=1

    N=2

    X=.N

    other=.U;

  invalue degf

    H=1

    A=2

    B=3

    M=4

    X=.N

    other=.U;

run;

data want;

  input @1 (fdobmo fdobdy) (2.)

       (ever_mar married pat_ack) (chtono1.)

        mat_deg degf1.;

  cards;

0315YYYH

0617XXUB

1002NN2M

12142NXX

;

run;

FriedEgg
SAS Employee

proc format;

invalue chtono (default=1)

    'Y'=        1

    'N'=        2

    'X'=        .N

    other=      .U;

run;

data want;

input @1 x chtono.  /* since defined default in proc format do not need to define chtono<w>. */

       @2 y chtono.  /* could just use chtono1. instead for same result */;

cards;

12

YN

XY

NX

21

;

proc print data=want noobs;

run;

x y

U U

1 2

N 1

2 N

U U

anjgupta
Calcite | Level 5

Thanks to you both.  Think it's working!   Didn't know about the default option - the learning never stops.  This is a huuuuggge help and I appreciate your time.

Ksharp
Super User

SAS treat . .A - .Z  all as numeric missing value.

FriedEgg
SAS Employee

.A - .Z are valid numeric invalues:

data _null_;

input x @@;

cards;

.A .B .C .D

.E .F .G .H

.I .J .K .L

.M .N .O .P

.Q .R .S .T

.U .V .W .X

.Y .Z

;

proc print; where x <= .E;

run;

Obs x

1 A

2 B

3 C

4 D

5 E

Ksharp
Super User

Yes.But they are all missing value for numeric type, just like dot.

Ksharp

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 20 replies
  • 1864 views
  • 6 likes
  • 4 in conversation