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

So i am currently trying to recode a data set so that some variables that are currently character, are numeric.  Now keep in mind, even though they are character variables, they still have the values 1,2,3, etc... (no letters).

I am trying to change the formatting so that these are numeric variables and not character variables.

Can anybody see what I'm doing wrong?  I've been looking at it for a while now and can't figure it out.

CODING:

PROC FREQ DATA=WORK.MASTER_FILE5;

  TABLES type ownership ownership1;

  TITLE1 TYPE OWNERSHIP ownership1;

RUN;

*HERE I GET A PERFECTLY REASONABLE LIST OF DATA) BUT WHEN I MAKE MY NEW VARIABLES....*;

DATA work.master_file5_TESTING;

  set work.master_file5;

  newownership = input(ownership,8.);

  newownership1 = input(ownership1,8.);

  newtype = input(type, 8.);

RUN;

PROC FREQ DATA=work.master_file5_TESTING;

  TABLES newownership newownership1 newtype;

RUN;

*THIS PROC FREQ ANALYSIS REPORTS THAT ALL VALUES ARE MISSING*;

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Try

DATA work.master_file5_TESTING;

  set work.master_file5;

  newownership = input(left(ownership),8.);

  newownership1 = input(left(ownership1),8.);

  newtype = input(left(type), 8.);

RUN;

PG

PG

View solution in original post

1 REPLY 1
PGStats
Opal | Level 21

Try

DATA work.master_file5_TESTING;

  set work.master_file5;

  newownership = input(left(ownership),8.);

  newownership1 = input(left(ownership1),8.);

  newtype = input(left(type), 8.);

RUN;

PG

PG

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 627 views
  • 0 likes
  • 2 in conversation