number to string

I am doing a program that I wanto to create variables in order, say X1, x3...X8

I am doing a program as this

for years (1,8,1);
proc stats(name,curr_stats1) ;
local curr_stats,mean_curr_stats ;
curr_stats=varget(name$+"_1") ;
mean_curr_stats=sumc(curr_stats)/sumc(curr_stats.>0) ;
print mean_curr_stats;
endp;
endfor;
stats("simul_wages_male",simul_wages_male_1) ;

But as you can see I am not able to do something like

curr_stats=varget(name$+"_"$+years)

because years is a numeric scalar, so my question is, how can I convert a scalar into a string to automatize the process?

 

3 Answers



0



If you have GAUSS 14 or newer, you can use the function ntos. Here is a basic example:

for i(1, 5, 1);
   print "my_variable_"$+ntos(i);
endfor;

aptech

1,218


0



I have Gauss 13 🙁



0



Well then I think the simplest replacement for ntos would be this:

for i(1, 5, 1);
   print "my_variable_"$+cvtos(ftocv(i, 0, 0));
endfor;

aptech

1,218

Your Answer


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

REQUEST A FREE QUOTE

Thank you for your interest in the GAUSS family of products.

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap