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

Hello,

 

 

Can anybody tell me , What is the pound sign used for in the DATA _NULL_?

 

Regards,

Jaiganesh

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
data _null_;
  file print;
  put @1 'Hello'
      #6 @5 'World!';
run;

produces:

data_null_hello_put.png

 

Cynthia

View solution in original post

9 REPLIES 9
PGStats
Opal | Level 21

One place you may find the pound sign (#) in a data step (_null_ or other) is in an input statement, where it is used as a line pointer control.

PG
jaiganesh
Obsidian | Level 7
Could you please provide me a example on this.
ballardw
Super User

It is not restricted to data _null_ code.

Generally it would refer to a line or record of the file accessible to an input statement.

It interacts with the N= option on an INFILE statement.

 

Astounding
PROC Star

If you are asking the question, there are likely a lot of details that you need to learn first.  Just addressing the question itself ...

 

In a data _NULL_ step, the pound sign is typically used when the purpose of the DATA step is to generate some sort of text file using PUT statements.  The text file is often a report, but could conceivably be a data file.

 

The pound sign appears within a PUT statement with a number immediately following.  That number indicates which line number the PUT statement should write to.

Cynthia_sas
SAS Super FREQ
Hi:
As you can see, the pound sign # can be used in the DATA step (not just a _NULL_) when you are using either INPUT or PUT statements.

What code are you trying to figure out? Where do you see a pound sign? What is the purpose of the program? Since the use of pound sign is possible in different contexts, it's nearly impossible to answer your question without understanding the context that you are dealing with.

Cynthia
jaiganesh
Obsidian | Level 7
Encountered with this question in one Interview, The above question was the exact question asked, If you could just give small program on this with Put would be deeply appreciated, I will take this topic from there.
jaiganesh
Obsidian | Level 7
Could you please give me small example on this.
Cynthia_sas
SAS Super FREQ
data _null_;
  file print;
  put @1 'Hello'
      #6 @5 'World!';
run;

produces:

data_null_hello_put.png

 

Cynthia

jaiganesh
Obsidian | Level 7
Thank You so much for your Help.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 9 replies
  • 1498 views
  • 1 like
  • 5 in conversation