BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi ,
I need to export it to text file.While exporting am not getting any headers on the text file. If i use proc export am not getting variables on proper order.
Can you let me know wht to add on the code to get an header while using data_null step.

data _null_;

set Class;
file "&drv2\ABC\ABC6_Class.txt" dlm="||";

put compno clamno2 lineno ;
run;

Thanks in advance !!
5 REPLIES 5
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Raveenat,

To get a desired order one can use the RETAIN statement before SET like this:
[pre]
data _null_;
retain compno clamno2 lineno;
set Class;
file "&drv2\ABC\ABC6_Class.txt" dlm="||";
put compno clamno2 lineno;
run;
[/pre]
Sincerely,
SPR
deleted_user
Not applicable
Hi SPR,

My intention is to get an header while exporting using data _null_ step.
If i use proc export , then the variables are not on the desirable order.

Thanks
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Did you try retain?
deleted_user
Not applicable
Yes SPR I tried as below code, but am not getting an header

data class;
input var1 var2 var3;
cards;
1 2 3
4 5 6
7 8 9
;
run;
data _null_;
retain var1 var2 var3;
set Class;
file "C:\Documents and Settings\Desktop\output.txt" dlm="||";
put var1 var2 var3;
run;
ballardw
Super User
if _n_ = 1 put "header 1" "header 2" "header3";

is a minimal way to get something as a header.
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
  • 5 replies
  • 1580 views
  • 0 likes
  • 3 in conversation