BookmarkSubscribeRSS Feed
User_Help
Obsidian | Level 7

Hi all,

 

I m using SAS EG, realized the data source i had imported was with incorrect "Informat".

Would like to change data source from "Character" to "Numeric". (not alter in Query Builder)

Anyone could help me out?

Thanks!

 

allenpee_1-1603415165604.png

 

3 REPLIES 3
jimbarbour
Meteorite | Level 14
I typically would just reimport the data. During the the import process, one can choose the I format to be used. One does not have to accept the determinations that SAS makes.

Jim
User_Help
Obsidian | Level 7

How could i do this in Query Builder?

As when i wanna changed from "Character" to "Comma20.5", it appeared as below"

 

allenpee_1-1603437276414.png

 

allenpee_0-1603437212278.png

 

Please assist.

 

jimbarbour
Meteorite | Level 14

Well, first of course click on Query Builder.

 

When the first screen of Query Builder opens, click on "Add a New Computed Column."  I'm using EG 8.2, but other versions will have something similar.

jimbarbour_0-1603680596189.png

Notice in the above that I have a variable called Num_Char which contains numbers but has been defined as character.

 

When you click on "Add a New Computed Column," click on "Advanced expression" and click on "Next".

jimbarbour_0-1603680734631.png

 

In the next screen, type in INPUT(your_variable_name, 8.) in the expression window.  My variable name is Num_Char, but you should substitute your variable name.  Click on "Next."

jimbarbour_2-1603680811315.png

 

In the next window, type in the name of the column, the length (generally 8 for numeric variables), and the desired format (in this case COMMA20.5).

 

jimbarbour_0-1603681249160.png

 

Click on "Next," and in the following window, click on "Finish."  When you click on "Finish," the Query Builder dialog windows will close, and you'll be back to the main Query Builder window.  Click on "Run."

 

The Query will run, and you will have a new column named with whatever name you gave it (I typically would use the original character name but the definition will now be numeric).

 

Jim

 

 

 

 

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1072 views
  • 0 likes
  • 2 in conversation