Stata 12 Serial Number

There are times we need to do some repetitive tasks in the process of data preparation, analysis or presentation, for instance, computing a set of variables in a same manner, rename or create a series of variables, or repetitively recode values of a number of variables. In this post, I show a few of simple example “loops” using Stata commands -foreach-, -local- and -forvalues- to handle some common simple repetitive tasks.

-foreach-: loop over items

Cool technology to make finding and buying parts a breeze, including Serial Number Lookup, PartSPIN® and Smart Manuals, found on partstown.com and our industry-leading mobile app An exceptional customer experience from the team you know and trust with every email, live chat, text and phone call, provided by a friendly and knowledgeable team. The serial and/or model number will be listed here; If your drive is not detected or connected to your computer: The USB devices have the serial numbers printed on the external cases and internal drives have the serial and part numbers on the drive labels. QR code: Some of our drives have the QR code printed on the label (see example below). . input data clear input year mtemp1-mtemp12 year mtemp1 mtemp2 mtemp3 mtemp4 mtemp5 mtemp6 mtemp7 mtemp8 mtemp9 mtemp10 mtemp11 mtemp12 1. 2013 4 3 5 14 18 23 25 22 19 15 7 6 2. 2014 -1 3 5 13 19 23 24 23 21 15 7 5 3. 2015 2 -1 7 14 21 24 25 24 21 14 11 10 4.

Consider this sample dataset of monthly average temperature for three years.

Now the mean temperatures of each month are in Centigrade, if we want to convert them to Fahrenheit, we could do the computation for the 12 variables.

However this takes a lot of typing. Alternatively, we can use the -foreach- command to achieve the same goal. In the following codes, we tell Stata to do the same thing (the computation: c*9/5+32) for each of the variable in the varlist – mtemp1 to mtemp12.

Serial

Note that braces must be specified with -foreach-. The open brace has to be on the same line as the foreach, and the close brace must be on a line by itself. It’s crucial to close loops properly, especially if you have one or more loops nested in another loop.

-local-: define macro

This was a rather simple repetitive task which can be handled solely by the foreach command. Here we introduce another command -local-, which is utilized a lot with commands like foreach to deal with repetitive tasks that are more complex. The -local- command is a way of defining macro in Stata. A Stata macro can contain multiple elements; it has a name and contents. Consider the following two examples:

Define a local macro called mcode and another called month, alter the contents of mcode in the foreach loop, then display them in a form of “mcode: month”.

Note when you call a defined macro, it has to be wrapped in “`” (left tick) and “‘” (apostrophe) symbols.

Stata 15 Serial Number

Rename multiple variables

Take the temperature dataset we created as an example. Let’s say we want to rename variables mtemp1-mtemp12 as mtempjan-mtenpdec. We can do so by just tweaking a bit of the codes in the previous example.

Define local macro mcode and month, then rename the 12 vars in the foreach loop.

We can obtain the same results in a slightly different way. This time we use another 12 variables fmtemp1-fmtemp12 as examples. Again, we will rename them as fmtempjan-fmtempdec.

Define local macro month, then define local macro monthII in the foreach loop with specifying the string function word to reference the contents of the local macro month.

Serial

I usually run -display- to see how the macro looks like before actually applying the defined macro on tasks like changing variable names, just to make sure I don’t accidentally change them to some undesired results or even cause errors; however the display line is not necessary in this case.

Here we rename them back to fmtemp1-fmtemp12.

-forvalues-: loop over consecutive values

Stata 12 Serial Number

The -forvalues- command is another command that gets to be used a lot in handling repetitive works. Consider the same temperature dataset we created, suppose we would like to generate twelve dummy variables (warm1-warm12) to reflect if each of the monthly average temperature is higher than the one in the previous year. For example, I will code warm1 for the year of 2014 as 1 if the value of fmtemp1 for 2014 is higher than the value for 2013. I will code all the warm variables as 99 for the year of 2013, since they don’t have references to compare in this case.

We can do this by running the following codes, then repeat them for twelve times to create the twelve variables warm1-warm12.

However this takes a lot of typing and may even create unwanted mistakes in the process of typing or copy-paste them over and over.

Instead, we can use -forvalues- to do so:

Reference
Baum, C. (2005). A little bit of Stata programming goes a long way… Working Papers in Economics, 69.

Stata 15 Serial Number Code Authorization

View the entire collection of UVA Library StatLab articles.

Yun Tai
CLIR Postdoctoral Fellow
University of Virginia Library

The production of the Auto-5 began in 1902. Produced by F.N., John M. Browning ordered 10,000 of these shotguns in his first order. In 1999 Browning issued the 'Final Tribute' version featuring engraved scenes of John M. Browning, the F.N. Factory and the Browning Brothers first store. Only 1,000 of these were produced in a high-grade wood. Production of the famous 'A-5' ceased after this final tribute.

To find your serial number, you will need to refer to your owner's manual. We have most owner's manuals online.

Date Historic Information Serial Number Info
1903-1939 First 10,000 shipped to U.S. Marked with 'BROWNING AUTOMATIC ARMS CO. OGDEN UTAH-U.S.A.' Very few serial number records remain. Beginning with Serial Number 1 to approximately 228,000. Exact production figures are not available. Year of manufacture on Pre-World War II production is strictly a guess.
1940-1946 From 1940 to 1946 production of the Auto-5 was turned over to Remington. Serial number is on the side of receiver. 'ABC' for American made Version. (A=16 gauge, B-12 gauge, C=20 gauge) 1946+229,000-237,000
1947 237001-249000
1948 249001-270000
1949 270001-285000
1950 285001-315000
1951 315001-346000
1952 F.N. took over production of the Auto-5. 346001-387000
1953 387000-438000
1954-55 Serial Numbering System changed. H=Standard Weight. L=Light Weight. H1-H83000
L1-L83000
1956 Serial Number designation for the Light Weight changed to G. H83001-H99000
G1-G23000
1957 Serial Numbering System changed again. M=Standard Weight. G=Light Weight. M22000-M85000
G23001-85000
1958-67 From 1958 serial numbers were preceded by the date of manufacture. 8M=standard weight for 1958. 8G=light weight for 1958.
Example: 8M1000 = A 1958 Auto-5 standard weight shotgun with serial number 1000
G85001-G99000
8G1-8G2000
M=standard weight
G=light weight
1968-76 In 1969 Browning started using two digits for the date of manufacture which was followed by a four digit code that identified the type of Auto-5:
M=standard weight
G=light weight
This was then followed by the serial number beginning with 1000.
Example: 69G1000 = A 1969 Auto-5 Lightweight 12 ga.. shotgun with a serial number of 1000.
M-standard weight
G=light weight
1976-1997 In 1976 Browning standardized its serial number identification which it followed until 1998.
1. Auto-5 Type 151=Magnum 12 gauge
161=Magnum 20 gauge
211=Light 12 gauge
221=Sweet 16
231=Light 20 gauge
2. Date of Manufacture
is a two digit code
Z=1
Y=2
X=3
W=4
V=5
T=6
R=7
P=8
N=9
M=0
3. Serial Number
beginning with 01001
at the start of each year.
Serial
Number Example:

01001RT151

This would be an Auto-5 Magnum 12 ga.,manufactured in 1976 with the serial number 01001.

1999 The Auto-5 will be discontinued for 2000. To commemorate this historic event for the Auto-5, Browning released the 'Final Tribute' version in 1999.
1. Serial Number
beginning with 1001
at the start of each year.
2. Date of Manufacture
is a two digit code
2000 (distribution began in 1999)
3. Auto-5 Type FT='Final Tribute' 12 ga.
Serial
Number Example:

2000FT1001

This would be a Auto-5 'Final Tribute' 12 ga., manufactured in 1999 with the serial number 1001.