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

Can any body help me out what is POS in the proc content out put and how system define the position the variable


proc content out pur.png
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@mrinmoy wrote:

First of all thanks a lot for your specific reply 

Are you telling that in proc content output the variable order is showing alphabaticaly but machine read first numarical variable then it reads char var.  


This is how SAS stores variables within a dataset observation.

First come 8-byte and 4-byte numeric variables. This is done so that most numeric variables align with 4- or 8-byte boundaries, which makes moving them in memory more efficient.

Then come the other numeric variables (length = 3,5,6,7), then the strings.

SAS keeps a logical sequence of variables (the VARNUM), which corresponds to the sequence in which variables appeared when the dataset was created. This is either the sequence in which the datastep compiler encountered the variables when compiling the code and setting up the PDV, or the sequence of variables in a select in proc sql. This sequence is used for displaying, proc print etc.

View solution in original post

7 REPLIES 7
Shmuel
Garnet | Level 18

POS is the starting position of the variable within the record (file observation).

Mainly you need no to care about it and it may change with data manipulation.

mrinmoy
Obsidian | Level 7

Could you please explain me how sas is defining the variable position. For reff kindly go through the attached doc.


proc content out pur.png
DanielSantos
Barite | Level 11

Hi.

 

It's the physical position inside the dataset file.

 

If you want to change this, one easy way is to recreate the table with PROC SQL:

 

proc sql noprint;

create table TAB as

select COL1, COL2, COL3, ... from TAB;

quit;

 

Hope it helps.

 

Daniel Santos @ www.cgd.pt

Shmuel
Garnet | Level 18

Counting positions start with 0.

- 1st variable is AGE starting POS=0 with length=8

- 2nd variable need start at pos=8 (=0+8)  is balance with length=8.

- 3rd variable need start at pos=16 (=8+8) is day with length=8.

- 4th variable need start at pos=24 (=16+8) is duration with length=8

As you can see, all numeric variables are length 8 and appear at the beginning of the record.

The 1st character variable is job starting pos=56 with length=16, 

so next char variable need start at pos=72 (=56+16) ...etc

mrinmoy
Obsidian | Level 7

First of all thanks a lot for your specific reply 

Are you telling that in proc content output the variable order is showing alphabaticaly but machine read first numarical variable then it reads char var.  

DanielSantos
Barite | Level 11

Hi.

 

Could it be that what you are looking for is the ORDER= option?

 

https://support.sas.com/community/newsletters/news/techtips/OrderOption.html

 

Hope it helps.

 

Daniel Santos @ www.cgd.pt

Kurt_Bremser
Super User

@mrinmoy wrote:

First of all thanks a lot for your specific reply 

Are you telling that in proc content output the variable order is showing alphabaticaly but machine read first numarical variable then it reads char var.  


This is how SAS stores variables within a dataset observation.

First come 8-byte and 4-byte numeric variables. This is done so that most numeric variables align with 4- or 8-byte boundaries, which makes moving them in memory more efficient.

Then come the other numeric variables (length = 3,5,6,7), then the strings.

SAS keeps a logical sequence of variables (the VARNUM), which corresponds to the sequence in which variables appeared when the dataset was created. This is either the sequence in which the datastep compiler encountered the variables when compiling the code and setting up the PDV, or the sequence of variables in a select in proc sql. This sequence is used for displaying, proc print etc.

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2299 views
  • 3 likes
  • 4 in conversation