Solved

Change the format of a field

Posted on 2011-03-03
3
729 Views
Last Modified: 2013-11-16
Hi,

How can i change the format of a field in sas. I want to keep the same name.

Tx
0
Comment
Question by:sonmic
3 Comments
 

Author Comment

by:sonmic
ID: 35025010
Forgotten
From text to numeric.
0
 
LVL 11

Accepted Solution

by:
theartfuldazzler earned 125 total points
ID: 35025067
DATA Char;  /* Data set with character variable */
  x = "123";
RUN;

DATA Num;  /* new dataset with numeric variable */
  SET Char;
    y = INPUT(x,best32.);
DROP x;
RENAME y = x;
RUN;
0
 
LVL 1

Expert Comment

by:wolfen351
ID: 35025071
Hi there

Easy

data newfile;
  length newvar 8;
  format newvar 8.2;
  set oldfile(ren=newvar=oldvar);
  newvar=oldvar;
run;
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MySQL going to sleep 4 63
Invalid Identifier Error 3 65
vcenter 6 u2 install question 1 85
Mysql not caching queries 4 47
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now